/// <summary> /// 加载供应商档案信息 /// </summary> private void LoadInfo(string supperId) { if (!string.IsNullOrEmpty(supperId)) { //1.加载供应商档案主信息 DataTable dt = DBHelper.GetTable("查看一条供应商档案信息", "tb_supplier", "*", " sup_id='" + supperId + "'", "", ""); if (dt != null && dt.Rows.Count > 0) { tb_supplier model = new tb_supplier(); CommonFuncCall.SetModlByDataTable(model, dt); CommonFuncCall.SetShowControlValue(this, model, "View"); DataTable dt_bill = CommonFuncCall.GetDataTable(); if (!string.IsNullOrEmpty(model.sup_type)) { lblsup_type.Text = CommonFuncCall.GetBillNameByBillCode(dt_bill, model.sup_type); } if (!string.IsNullOrEmpty(model.unit_properties)) { lblunit_properties.Text = CommonFuncCall.GetBillNameByBillCode(dt_bill, model.unit_properties); } if (!string.IsNullOrEmpty(model.price_type)) { lblprice_type.Text = CommonFuncCall.GetBillNameByBillCode(dt_bill, model.price_type); } if (!string.IsNullOrEmpty(model.credit_class)) { lblcredit_class.Text = CommonFuncCall.GetBillNameByBillCode(dt_bill, model.credit_class); } if (!string.IsNullOrEmpty(model.county)) { lblsup_address.Text = CommonFuncCall.GetAddress(model.county) + " " + lblsup_address.Text; } else { if (!string.IsNullOrEmpty(model.city)) { lblsup_address.Text = CommonFuncCall.GetAddress(model.city) + " " + lblsup_address.Text; } else { if (!string.IsNullOrEmpty(model.province)) { lblsup_address.Text = CommonFuncCall.GetAddress(model.province) + " " + lblsup_address.Text; } } } } } }
/// <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); } }
/// <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); } }