Beispiel #1
0
 public void GetControlInfo(tb_parts_purchase_order_2 model)
 {
     if (!string.IsNullOrEmpty(ddtreq_delivery_time.Value))
     {
         ddtreq_delivery_time.Value = Convert.ToDateTime(ddtreq_delivery_time.Value).ToShortDateString() + " 23:59:59";
     }
     CommonFuncCall.SetModelObjectValue(this, model);
     if (!string.IsNullOrEmpty(ddlemergency_level.SelectedValue.ToString()))
     {
         model.emergency_level_name = ddlemergency_level.SelectedItem.ToString();
     }
     if (!string.IsNullOrEmpty(ddlactivity_type.SelectedValue.ToString()))
     {
         model.activity_type_name = ddlactivity_type.SelectedItem.ToString();
     }
     if (!string.IsNullOrEmpty(ddlproduct_notice_num.SelectedValue.ToString()))
     {
         model.product_notice_num_name = ddlproduct_notice_num.SelectedItem.ToString();
     }
     if (!string.IsNullOrEmpty(ddlreq_delivery.SelectedValue.ToString()))
     {
         model.req_delivery_name = ddlreq_delivery.SelectedItem.ToString();
     }
     if (!string.IsNullOrEmpty(ddlconsignee_code.SelectedValue.ToString()))
     {
         model.consignee = ddlconsignee_code.Text.ToString();
     }
 }
        /// <summary>
        /// 添加供应商档案的sql语句
        /// </summary>
        /// <param name="listSql"></param>
        /// <param name="partID"></param>
        private void AddWareHouseSqlString(List <SysSQLString> listSql, string whId)
        {
            SysSQLString sysStringSql = new SysSQLString();

            sysStringSql.cmdType = CommandType.Text;
            Dictionary <string, string> dicParam = new Dictionary <string, string>();//参数

            tb_warehouse model = new tb_warehouse();

            CommonFuncCall.SetModelObjectValue(this, model);
            model.wh_id = whId;
            int datasorces = (int)SYSModel.DataSources.EnumDataSources.SELFBUILD;//1自建,2宇通

            model.data_source = datasorces.ToString();
            int StatusNum = (int)SYSModel.DataSources.EnumStatus.Start;//0停用,1启用

            model.status      = StatusNum.ToString();
            model.enable_flag = "1";
            model.create_by   = GlobalStaticObj.UserID;
            model.create_time = Common.LocalDateTimeToUtcLong(DateTime.Now);
            model.com_id      = txtChooseCompanty.Tag == null ? "" : txtChooseCompanty.Tag.ToString();
            model.wh_head     = txtChooseWhHead.Text;
            if (model != null)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append(" Insert Into tb_warehouse( ");
                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);
            }
        }
        /// <summary>
        /// 编辑供应商档案的sql语句
        /// </summary>
        /// <param name="listSql"></param>
        /// <param name="supID"></param>
        /// <param name="model"></param>
        private void EditWareHouseSqlString(List <SysSQLString> listSql, string whId, tb_warehouse 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);
            model.com_id      = txtChooseCompanty.Tag == null ? "" : txtChooseCompanty.Tag.ToString();
            model.wh_head     = txtChooseWhHead.Text;
            if (model != null)
            {
                StringBuilder sb = new StringBuilder();
                sb.Append(" Update tb_warehouse 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 wh_id='" + whId + "';");
                sysStringSql.sqlString = sb.ToString();
                sysStringSql.Param     = dicParam;
                listSql.Add(sysStringSql);
            }
        }
Beispiel #4
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);
            }
        }