关闭

some code

599人阅读 评论(0) 收藏 举报

车辆参数修改(sfbaseinfo.cs)
1。EditBrand
注释掉
//不检查相同名字
//    m_ExecuteSql.Select(ds.TCarParameter.TableName,ds," where vManufacturer=" + CAfflux.ConvertToString(Manufacturer) + " and vBrand=" + CAfflux.ConvertToString(NewBrand));
//    if(ds.TCarParameter.Rows.Count != 0)
//    {
//     m_strrErr = SFSystemSetting.SFLocalize.GetLocalizeMsg("RepeatData");
//     return false;
//    }
//不检查相同名字

增加
//同时修改tcar表对应信息
    Item.DataAccess.CSqlExecution m=new CSqlExecution();
    m.ExecNonQuery("update Tcar set vBrand="+CAfflux.ConvertToString(NewBrand)+"  where vManufacturer=" + CAfflux.ConvertToString(Manufacturer) + " and vBrand=" + CAfflux.ConvertToString(OldBrand));
    //修改结束 
 

2。
EditManufacturer
原厂不能修改成相同的

增加
//同时修改tcar表对应信息060529
    Item.DataAccess.CSqlExecution m=new CSqlExecution();
    m.ExecNonQuery("update Tcar set vManufacturer="+CAfflux.ConvertToString(NewManufacturer)+" where vManufacturer=" + CAfflux.ConvertToString(OldManufacturer));
    //修改结束 


3。 EditModel
型号不能修改成相同的

增加
//同时修改tcar表对应信息060529
    Item.DataAccess.CSqlExecution m=new CSqlExecution();
    m.ExecNonQuery("update Tcar set vModel="+CAfflux.ConvertToString(NewModel)+" where vManufacturer=" + CAfflux.ConvertToString(Manufacturer) + " and vBrand=" + CAfflux.ConvertToString(Brand) + " and  vCatena=" + CAfflux.ConvertToString(Series) + " and  vModel=" + CAfflux.ConvertToString(OldModel));
    //修改结束 


4。EditSeries
注释掉
//不检查相同名字
//    m_ExecuteSql.Select(ds.TCarParameter.TableName,ds," where vManufacturer=" + CAfflux.ConvertToString(Manufacturer) + " and vBrand=" + CAfflux.ConvertToString(Brand) + " and  vSeries=" + CAfflux.ConvertToString(NewSeries));
//    if(ds.TCarParameter.Rows.Count != 0)
//    {
//     m_strrErr = SFSystemSetting.SFLocalize.GetLocalizeMsg("RepeatData");
//     return false;
//    }

增加
//同时修改tcar表对应信息060529
    Item.DataAccess.CSqlExecution m=new CSqlExecution();
    m.ExecNonQuery("update Tcar set vCatena="+CAfflux.ConvertToString(NewSeries)+" where vManufacturer=" + CAfflux.ConvertToString(Manufacturer) + " and vBrand=" + CAfflux.ConvertToString(Brand) + " and  vCatena=" + CAfflux.ConvertToString(OldSeries));
    //修改结束 

 

删除重复记录
delete from TCarParameter where nID not in(select min(nID) from TCarParameter group by [vManufacturer], [vBrand], [vSeries], [vModel], [vModelExplain])
查找重复记录

select[vManufacturer], [vBrand], [vSeries], [vModel], [vModelExplain],COUNT(*) from TCarParameter group by [vManufacturer], [vBrand], [vSeries], [vModel], [vModelExplain] having count(*)>1


查找特定重复记录的条数
select COUNT(*) from TCarParameter where vManufacturer='日产' group by [vManufacturer], [vBrand], [vSeries], [vModel], [vModelExplain] having count(*)>1


string havenum="0";
    if(!m_ExecuteSql.Select("select COUNT(*) from TCarParameter group by [vManufacturer], [vBrand], [vSeries], [vModel], [vModelExplain] having count(*)>1",out havenum))
    {
     return false;
    }
    if ( Convert.ToInt32(havenum) != 0)
    {
     m.ExecNonQuery("delete from TCarParameter where nID not in(select min(nID) from TCarParameter group by [vManufacturer], [vBrand], [vSeries], [vModel], [vModelExplain])");
    }
    

 

修改按字母列排的品牌表,原厂表空白字符的问题
sfbaseinfo.cs
数组长度固定 ArrayList  可变
增加一个ArrayList  把字母加进去
ArrayList myalManufacturers = new ArrayList();
    string first;
    for(int i = 0; i < strArrManufacturers.Count; i++)
    {
     //首字母
     if(i==0)
     {
      first=Item.Common.CString.Chr2Py(((ArrayList)strArrManufacturers[i])[0].ToString()).Trim().ToUpper().Substring(0,1);
      myalManufacturers.Add("------"+first+"------");
      myalManufacturers.Add(((ArrayList)strArrManufacturers[i])[0].ToString());
     }
     if(i!=0)
     {
      first=Item.Common.CString.Chr2Py(((ArrayList)strArrManufacturers[i])[0].ToString()).Trim().ToUpper().Substring(0,1);
      if(first!=Item.Common.CString.Chr2Py(((ArrayList)strArrManufacturers[i-1])[0].ToString()).Trim().ToUpper().Substring(0,1))
      {
       myalManufacturers.Add("------"+first+"------");
       myalManufacturers.Add(((ArrayList)strArrManufacturers[i])[0].ToString());
      }
      else
      {
       myalManufacturers.Add(((ArrayList)strArrManufacturers[i])[0].ToString());
      }
     } 
   
    }

 

sfbuycar.cs

ArrayList myalBrand = new ArrayList();
   string first;
   for(int i = 0; i < alBrand.Count; i++)
   {
    //首字母
    if(i==0)
    {
     first=Item.Common.CString.Chr2Py(((ArrayList)alBrand[i])[0].ToString()).Trim().ToUpper().Substring(0,1);
     myalBrand.Add("------"+first+"------");
     myalBrand.Add(((ArrayList)alBrand[i])[0].ToString());
    }
    if(i!=0)
    {
     first=Item.Common.CString.Chr2Py(((ArrayList)alBrand[i])[0].ToString()).Trim().ToUpper().Substring(0,1);
     if(first!=Item.Common.CString.Chr2Py(((ArrayList)alBrand[i-1])[0].ToString()).Trim().ToUpper().Substring(0,1))
     {
      myalBrand.Add("------"+first+"------");
      myalBrand.Add(((ArrayList)alBrand[i])[0].ToString());
     }
     else
     {
      myalBrand.Add(((ArrayList)alBrand[i])[0].ToString());
     }
    } 
   
   }

 

 

查当前的车辆数量 SELECT count(*) from tcar where DATEDIFF(Day, dPromulgate, getdate())=0


if not exists (select 1 from dbo.syscolumns
where id = object_id(N'[dbo].[news]')
and name='EDITER')
  alter table [dbo].[news] add  EDITER NVARCHAR(50) NULL
GO

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:82659次
    • 积分:1225
    • 等级:
    • 排名:千里之外
    • 原创:37篇
    • 转载:15篇
    • 译文:0篇
    • 评论:16条
    最新评论