Ejemplo n.º 1
0
 /// <summary>
 /// 编辑供应商档案的sql语句
 /// </summary>
 /// <param name="listSql"></param>
 /// <param name="supID"></param>
 /// <param name="model"></param>
 private void EditSupplierSqlString(List<SysSQLString> listSql, string supID, tb_supplier model)
 {
     SysSQLString sysStringSql = new SysSQLString();
     sysStringSql.cmdType = CommandType.Text;
     Dictionary<string, string> dicParam = new Dictionary<string, string>();//参数
     CommonFuncCall.SetModelObjectValue(this, model);
     model.update_by = GlobalStaticObj.UserID;
     model.update_time = Common.LocalDateTimeToUtcLong(DateTime.Now);
     if (model != null)
     {
         StringBuilder sb = new StringBuilder();
         sb.Append(" Update tb_supplier Set ");
         bool isFirstValue = true;
         foreach (PropertyInfo info in model.GetType().GetProperties())
         {
             string name = info.Name;
             object value = info.GetValue(model, null);
             if (isFirstValue)
             {
                 isFirstValue = false;
                 sb.Append(name);
                 sb.Append("=");
                 sb.Append("@" + name);
             }
             else
             {
                 sb.Append("," + name);
                 sb.Append("=");
                 sb.Append("@" + name);
             }
             dicParam.Add(name, value == null ? "" : value.ToString());
         }
         sb.Append(" where sup_id='" + supID + "';");
         sysStringSql.sqlString = sb.ToString();
         sysStringSql.Param = dicParam;
         listSql.Add(sysStringSql);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 添加供应商档案的sql语句
        /// </summary>
        /// <param name="listSql"></param>
        /// <param name="partID"></param>
        private void AddSupplierSqlString(List<SysSQLString> listSql, string supID)
        {
            SysSQLString sysStringSql = new SysSQLString();
            sysStringSql.cmdType = CommandType.Text;
            Dictionary<string, string> dicParam = new Dictionary<string, string>();//参数

            tb_supplier model = new tb_supplier();
            CommonFuncCall.SetModelObjectValue(this, model);
            model.sup_first_spell = "ZJHLCH";
            model.sup_id = supID;
            model.enable_flag = "1";
            int StatusNum = (int)SYSModel.DataSources.EnumStatus.Start;//0停用,1启用
            model.status = StatusNum.ToString();
            model.create_by = GlobalStaticObj.UserID;
            model.create_time = Common.LocalDateTimeToUtcLong(DateTime.Now);
            if (model != null)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append(" Insert Into tb_supplier( ");
                StringBuilder sp = new StringBuilder();
                StringBuilder sb_prame = new StringBuilder();
                foreach (PropertyInfo info in model.GetType().GetProperties())
                {
                    string name = info.Name;
                    object value = info.GetValue(model, null);
                    sb_prame.Append("," + name);
                    sp.Append(",@" + name);
                    dicParam.Add(name, value == null ? "" : value.ToString());
                }
                sb.Append(sb_prame.ToString().Substring(1, sb_prame.ToString().Length - 1) + ") Values (");
                sb.Append(sp.ToString().Substring(1, sp.ToString().Length - 1) + ")").Append(";");
                sysStringSql.sqlString = sb.ToString();
                sysStringSql.Param = dicParam;
                listSql.Add(sysStringSql);
            }
        }