Beispiel #1
0
        /// <summary>
        /// 部分修改保存
        /// </summary>
        /// <param name="model">对象clsCompany的一个实例参数</param>
        /// <returns></returns>
        public int UpdatePart(clsCompany model, string sOldCode, out string errMsg)
        {
            errMsg = string.Empty;
            int rtn = 0;

            try
            {
                sb.Length = 0;
                sb.Append("UPDATE TCOMPANY SET ");
                sb.AppendFormat("StdCode='{0}',", model.StdCode);
                sb.AppendFormat("CAllow='{0}',", model.CAllow);
                sb.AppendFormat("CompanyID='{0}',", model.CompanyID);
                sb.AppendFormat("OtherCodeInfo='{0}',", model.OtherCodeInfo);
                sb.AppendFormat("FullName='{0}',", model.FullName);
                sb.AppendFormat("ShortName='{0}',", model.ShortName);
                sb.AppendFormat("DisplayName='{0}',", model.DisplayName);
                sb.AppendFormat("ShortCut='{0}',", model.ShortCut);
                sb.AppendFormat("Property='{0}',", model.Property);
                sb.AppendFormat("KindCode='{0}',", model.KindCode);
                sb.AppendFormat("RegCapital={0},", model.RegCapital);
                sb.AppendFormat("Unit='{0}',", model.Unit);
                sb.AppendFormat("Incorporator='{0}',", model.Incorporator);
                if (model.RegDate != null)
                {
                    sb.AppendFormat("RegDate='{0}',", model.RegDate);
                }
                if (model.RegDate == null)
                {
                    sb.AppendFormat("RegDate=null,", string.Empty);
                }
                sb.AppendFormat("DistrictCode='{0}',", model.DistrictCode);
                sb.AppendFormat("PostCode='{0}',", model.PostCode);
                sb.AppendFormat("Address='{0}',", model.Address);
                sb.AppendFormat("LinkMan='{0}',", model.LinkMan);
                sb.AppendFormat("LinkInfo='{0}',", model.LinkInfo);
                sb.AppendFormat("CreditLevel='{0}',", model.CreditLevel);
                sb.AppendFormat("CreditRecord='{0}',", model.CreditRecord);
                sb.AppendFormat("ProductInfo='{0}',", model.ProductInfo);
                sb.AppendFormat("OtherInfo='{0}',", model.OtherInfo);
                sb.AppendFormat("CheckLevel='{0}',", model.CheckLevel);
                sb.AppendFormat("FoodSafeRecord='{0}',", model.FoodSafeRecord);
                sb.AppendFormat("IsReadOnly={0},", model.IsReadOnly);
                sb.AppendFormat("IsLock={0},", model.IsLock);
                sb.AppendFormat("Remark='{0}',", model.Remark);
                sb.AppendFormat("ComProperty='{0}'", model.ComProperty);
                sb.AppendFormat("  WHERE SysCode='{0}'", sOldCode);
                DataBase.ExecuteCommand(sb.ToString(), out errMsg);
                sb.Length = 0;
                rtn       = 1;
            }
            catch (Exception e)
            {
                errMsg = e.Message;
            }
            return(rtn);
        }
Beispiel #2
0
        /// <summary>
        /// 插入一条明细记录
        /// </summary>
        /// <param name="model">ID>0为修改 ID=0为新增</param>
        /// <returns></returns>
        public int Insert(clsCompany model, out string errMsg)
        {
            errMsg = string.Empty;
            int rtn = 0;

            try
            {
                sb.Length = 0;
                if (model.ID > 0)
                {
                    //修改
                    sb.AppendFormat("Update tCompany Set SysCode = '{0}',StdCode = '{1}',CAllow = '{2}',", model.SysCode, model.StdCode, model.CAllow);
                    sb.AppendFormat("ISSUEAGENCY = '{0}',ISSUEDATE = '{1}',PERIODSTART = '{2}',PERIODEND = '{3}',", model.ISSUEAGENCY, model.ISSUEDATE, model.PERIODSTART, model.PERIODEND);
                    sb.AppendFormat("VIOLATENUM = '{0}',LONGITUDE = '{1}',LATITUDE = '{2}',SCOPE = '{3}',", model.VIOLATENUM, model.LONGITUDE, model.LATITUDE, model.SCOPE);
                    sb.AppendFormat("PUNISH = '{0}',CompanyID = '{1}',OtherCodeInfo = '{2}',FullName = '{3}',", model.PUNISH, model.CompanyID, model.OtherCodeInfo, model.FullName);
                    sb.AppendFormat("ShortName = '{0}',DisplayName = '{1}',ShortCut = '{2}',Property = '{3}',", model.ShortName, model.DisplayName, model.ShortCut, model.Property);
                    sb.AppendFormat("KindCode = '{0}',RegCapital = '{1}',Unit = '{2}',Incorporator = '{3}',", model.KindCode, model.RegCapital, model.Unit, model.Incorporator);
                    //sb.AppendFormat("RegDate = '{0}',DistrictCode = '{1}',Address = '{2}',PostCode = '{3}',", model.RegDate, model.DistrictCode, model.Address, model.PostCode);
                    sb.AppendFormat("DistrictCode = '{0}',Address = '{1}',PostCode = '{2}',", model.DistrictCode, model.Address, model.PostCode);
                    sb.AppendFormat("LinkMan = '{0}',LinkInfo = '{1}',CreditLevel = '{2}',CreditRecord = '{3}',", model.LinkMan, model.LinkInfo, model.CreditLevel, model.CreditRecord);
                    sb.AppendFormat("ProductInfo = '{0}',OtherInfo = '{1}',CheckLevel = '{2}',FoodSafeRecord = '{3}',", model.ProductInfo, model.OtherInfo, model.CheckLevel, model.FoodSafeRecord);
                    sb.AppendFormat("IsReadOnly = {0},IsLock = {1},Remark = '{2}',ComProperty = '{3}',", model.IsReadOnly, model.IsLock, model.Remark, model.ComProperty);
                    sb.AppendFormat("TSign = '{0}' Where ID = {1}", model.TSign, model.ID);
                }
                else
                {
                    //新增
                    sb.Append("INSERT INTO tCompany");
                    sb.Append("(SysCode,StdCode,CAllow,ISSUEAGENCY,ISSUEDATE,PERIODSTART,PERIODEND,VIOLATENUM,LONGITUDE,LATITUDE,SCOPE,PUNISH,CompanyID,OtherCodeInfo,FullName,");
                    sb.Append("ShortName,DisplayName,ShortCut,Property,KindCode,RegCapital,Unit,Incorporator,");
                    if (model.RegDate != null)
                    {
                        sb.Append("RegDate,");
                    }
                    sb.Append("DistrictCode,PostCode,Address,LinkMan,LinkInfo,");
                    sb.Append("CreditLevel,CreditRecord,ProductInfo,OtherInfo,CheckLevel,FoodSafeRecord,IsReadOnly,IsLock,Remark,ComProperty,TSign)");
                    sb.Append(" VALUES(");
                    sb.AppendFormat("'{0}',", model.SysCode);
                    sb.AppendFormat("'{0}',", model.StdCode);
                    sb.AppendFormat("'{0}',", model.CAllow);
                    sb.AppendFormat("'{0}',", model.ISSUEAGENCY);
                    sb.AppendFormat("'{0}',", model.ISSUEDATE);
                    sb.AppendFormat("'{0}',", model.PERIODSTART);
                    sb.AppendFormat("'{0}',", model.PERIODEND);
                    sb.AppendFormat("'{0}',", model.VIOLATENUM);
                    sb.AppendFormat("'{0}',", model.LONGITUDE);
                    sb.AppendFormat("'{0}',", model.LATITUDE);
                    sb.AppendFormat("'{0}',", model.SCOPE);
                    sb.AppendFormat("'{0}',", model.PUNISH);
                    sb.AppendFormat("'{0}',", model.CompanyID);
                    sb.AppendFormat("'{0}',", model.OtherCodeInfo);
                    sb.AppendFormat("'{0}',", model.FullName);
                    sb.AppendFormat("'{0}',", model.ShortName);
                    sb.AppendFormat("'{0}',", model.DisplayName);
                    sb.AppendFormat("'{0}',", model.ShortCut);
                    sb.AppendFormat("'{0}',", model.Property);
                    sb.AppendFormat("'{0}',", model.KindCode);
                    sb.AppendFormat("{0},", model.RegCapital);
                    sb.AppendFormat("'{0}',", model.Unit);
                    sb.AppendFormat("'{0}',", model.Incorporator);
                    if (model.RegDate != null)
                    {
                        sb.AppendFormat("'{0}',", model.RegDate);
                    }
                    sb.AppendFormat("'{0}',", model.DistrictCode);
                    sb.AppendFormat("'{0}',", model.PostCode);
                    sb.AppendFormat("'{0}',", model.Address);
                    sb.AppendFormat("'{0}',", model.LinkMan);
                    sb.AppendFormat("'{0}',", model.LinkInfo);
                    sb.AppendFormat("'{0}',", model.CreditLevel);
                    sb.AppendFormat("'{0}',", model.CreditRecord);
                    sb.AppendFormat("'{0}',", model.ProductInfo);
                    sb.AppendFormat("'{0}',", model.OtherInfo);
                    sb.AppendFormat("'{0}',", model.CheckLevel);
                    sb.AppendFormat("'{0}',", model.FoodSafeRecord);
                    sb.AppendFormat("{0},", model.IsReadOnly);
                    sb.AppendFormat("{0},", model.IsLock);
                    sb.AppendFormat("'{0}',", model.Remark);
                    sb.AppendFormat("'{0}',", model.ComProperty);
                    sb.AppendFormat("'{0}'", model.TSign);
                    sb.Append(")");
                }
                DataBase.ExecuteCommand(sb.ToString(), out errMsg);
                sb.Length = 0;
                rtn       = 1;
            }
            catch (Exception e)
            {
                errMsg = e.Message;
            }
            return(rtn);
        }