public List<PD_PROJECT_CONTRACT_Model> DataTableToList(DataTable dt) { List<PD_PROJECT_CONTRACT_Model> list = new List<PD_PROJECT_CONTRACT_Model>(); int count = dt.Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { PD_PROJECT_CONTRACT_Model item = new PD_PROJECT_CONTRACT_Model { AUTO_NO = dt.Rows[i]["AUTO_NO"].ToString(), PD_PROJECT_CODE = dt.Rows[i]["PD_PROJECT_CODE"].ToString(), PD_CONTRACT_TYPE = dt.Rows[i]["PD_CONTRACT_TYPE"].ToString(), PD_CONTRACT_NO = dt.Rows[i]["PD_CONTRACT_NO"].ToString() }; if (dt.Rows[i]["PD_CONTRACT_DATE"].ToString() != "") { item.PD_CONTRACT_DATE = DateTime.Parse(dt.Rows[i]["PD_CONTRACT_DATE"].ToString()); } item.PD_CONTRACT_COMPANY = dt.Rows[i]["PD_CONTRACT_COMPANY"].ToString(); if (dt.Rows[i]["PD_CONTRACT_MOENY"].ToString() != "") { item.PD_CONTRACT_MOENY = new decimal?(int.Parse(dt.Rows[i]["PD_CONTRACT_MOENY"].ToString())); } if (dt.Rows[i]["PD_CONTRACT_MOENY_CHANGE"].ToString() != "") { item.PD_CONTRACT_MOENY_CHANGE = new decimal?(int.Parse(dt.Rows[i]["PD_CONTRACT_MOENY_CHANGE"].ToString())); } item.PD_CONTRACT_ASK_LIMIT = dt.Rows[i]["PD_CONTRACT_ASK_LIMIT"].ToString(); item.PD_CONTRACT_ASK_PROCEED = dt.Rows[i]["PD_CONTRACT_ASK_PROCEED"].ToString(); item.PD_CONTRACT_ASK_PAYMENT = dt.Rows[i]["PD_CONTRACT_ASK_PAYMENT"].ToString(); item.PD_CONTRACT_NOTE = dt.Rows[i]["PD_CONTRACT_NOTE"].ToString(); item.PD_CONTRACT_FILENAME = dt.Rows[i]["PD_CONTRACT_FILENAME"].ToString(); item.PD_CONTRACT_FILENAME_SYSTEM = dt.Rows[i]["PD_CONTRACT_FILENAME_SYSTEM"].ToString(); list.Add(item); } } return list; }
private void Save() { PD_PROJECT_CONTRACT_Bll bll = new PD_PROJECT_CONTRACT_Bll(); if (base.Request["UpdatePK"] != null) { if (PublicDal.PageValidate.IsDecimal(base.Request["UpdatePK"])) { PD_PROJECT_CONTRACT_Model model = bll.GetModel(base.Request["UpdatePK"].ToString()); this.getModel(model); bll.Update(model); PageShowText.Refurbish("修改成功", this.Page); } } else if (this.txtPD_PROJECT_CODE.Value != null) { PD_PROJECT_CONTRACT_Model model2 = new PD_PROJECT_CONTRACT_Model { PD_DB_LOOP = "1" }; this.getModel(model2); model2.PD_NOW_SERVERPK = PublicDal.SetCreateServiceStream(this.Page); bll.Add(model2); Const.DoSuccessNoClose("添加成功", this.Page.Request.Url.LocalPath + "?UpdatePK=" + model2.AUTO_NO, this.Page); } }
private void GetQUOTA(PD_PROJECT_CONTRACT_Model model) { DataSet set = null; DataView defaultView = null; string s = base.Server.UrlDecode(this.FilePostCtr1.getFileName); if ((s != null) && (s.Trim() != "")) { set = new DataSet(); XmlTextReader reader = new XmlTextReader(new StringReader(s)); set.ReadXml(reader); } if ((set != null) && (set.Tables.Count > 0)) { defaultView = set.Tables[0].DefaultView; } if (defaultView != null) { defaultView.RowFilter = " tableID='zxzb_bt' "; if (defaultView.Count > 0) { model.PD_CONTRACT_FILENAME = defaultView[0]["FileName"].ToString(); model.PD_CONTRACT_FILENAME_SYSTEM = defaultView[0]["FileSysName"].ToString(); } } }
private void getModel(PD_PROJECT_CONTRACT_Model model) { model.PD_PROJECT_CODE = this.txtPD_PROJECT_CODE.Value; model.PD_CONTRACT_TYPE = this.txtPD_CONTRACT_TYPE.SelectedValue; model.PD_CONTRACT_NO = this.txtPD_CONTRACT_NO.Value; model.PD_CONTRACT_COMPANY = this.txtPD_CONTRACT_COMPANY.Text; model.PD_CONTRACT_ASK_LIMIT = this.txtPD_CONTRACT_ASK_LIMIT.Text; model.PD_CONTRACT_ASK_PROCEED = this.txtPD_CONTRACT_ASK_PROCEED.Value; model.PD_CONTRACT_ASK_PAYMENT = this.txtPD_CONTRACT_ASK_PAYMENT.Text; model.PD_CONTRACT_NOTE = this.txtPD_CONTRACT_NOTE.Text; model.PD_CONTRACT_NAME = this.txtPD_CONTRACT_NAME.Text; model.PD_YEAR = this.ddlPD_YEAR.SelectedValue; if (PublicDal.PageValidate.IsDateTime(this.txtPD_CONTRACT_DATE.Value)) { model.PD_CONTRACT_DATE = DateTime.Parse(this.txtPD_CONTRACT_DATE.Value); } else { model.PD_CONTRACT_DATE = new DateTime(); } if (PublicDal.PageValidate.IsInt(this.txtPD_CONTRACT_MOENY.Value)) { model.PD_CONTRACT_MOENY = new decimal?(int.Parse(this.txtPD_CONTRACT_MOENY.Value)); } if (PublicDal.PageValidate.IsInt(this.txtPD_CONTRACT_MOENY_CHANGE.Value)) { model.PD_CONTRACT_MOENY_CHANGE = new decimal?(int.Parse(this.txtPD_CONTRACT_MOENY_CHANGE.Value)); } this.GetQUOTA(model); }
private void Save() { PD_PROJECT_CONTRACT_Bll bll = new PD_PROJECT_CONTRACT_Bll(); PD_CONTRACT_CHANGE_Bll bll2 = new PD_CONTRACT_CHANGE_Bll(); if (base.Request["UpdatePK"] != null) { if (PublicDal.PageValidate.IsDecimal(base.Request["UpdatePK"])) { PD_PROJECT_CONTRACT_Model model = bll.GetModel(base.Request["UpdatePK"].ToString()); PD_CONTRACT_CHANGE_Model model2 = new PD_CONTRACT_CHANGE_Model(); PD_PROJECT_CONTRACT_BAK_Bll bll3 = new PD_PROJECT_CONTRACT_BAK_Bll(); this.getModel(model, model2); if (bll.Update(model)) { decimal? maxID = bll3.GetMaxID(model.PD_CONTRACT_NO); if (maxID.HasValue) { model2.CONTR_CHANGE_MIAN_ID = maxID.Value; } bll2.Add(model2); } Const.DoSuccessNoClose("合同变更成功", this.Page.Request.Url.LocalPath + "?UpdatePK=" + base.Request["UpdatePK"].ToString() + "&doType=look&strTitle=" + base.Request["strTitle"].ToString(), this.Page); this.Master.btModel.IfUpdate = true; } } else if (this.txtPD_PROJECT_CODE.Value != null) { PD_PROJECT_CONTRACT_Model model3 = new PD_PROJECT_CONTRACT_Model { PD_DB_LOOP = "1" }; PD_CONTRACT_CHANGE_Model model4 = new PD_CONTRACT_CHANGE_Model(); PD_PROJECT_CONTRACT_BAK_Bll bll4 = new PD_PROJECT_CONTRACT_BAK_Bll(); this.getModel(model3, model4); model3.PD_NOW_SERVERPK = PublicDal.SetCreateServiceStream(this.Page); bll.Add(model3); model4.PD_NOW_SERVERPK = PublicDal.SetCreateServiceStream(this.Page); this.getModel_BG(model4, model3); decimal? nullable2 = bll4.GetMaxID(model3.PD_CONTRACT_NO); if (nullable2.HasValue) { model4.CONTR_CHANGE_MIAN_ID = nullable2.Value; } bll2.Add(model4); Const.DoSuccessNoClose("添加成功", this.Page.Request.Url.LocalPath + "?UpdatePK=" + model3.AUTO_NO + "&doType=look&strTitle=", this.Page); } }
private void getModel_BG(PD_CONTRACT_CHANGE_Model c_model, PD_PROJECT_CONTRACT_Model model) { if (PublicDal.PageValidate.IsDateTime(this.txtPD_CONTRACT_CHANGE_DATE.Value)) { c_model.PD_CONTRACT_CHANGE_DATE = new DateTime?(Convert.ToDateTime(this.txtPD_CONTRACT_CHANGE_DATE.Value.ToString())); } if (PublicDal.PageValidate.IsDecimal(this.txtPD_CONTRACT_MOENY.Value)) { c_model.PD_CONTRACT_CHANGE_MONEY = new decimal?(Convert.ToDecimal(this.txtPD_CONTRACT_MOENY.Value)); } c_model.PD_CONTRACT_CHANGE_REASON = this.txtPD_CONTRACT_CHANGE_REASON.Value; c_model.PD_CONTRACT_CHANGE_TYPE = this.txtPD_CONTRACT_CHANGE_TYPE.SelectedValue; c_model.PD_CONTRACT_CHANGE_WH = this.txtPD_CONTRACT_CHANGE_WH.Value; c_model.PD_PROJECT_CODE = model.PD_PROJECT_CODE; c_model.PD_CONTRACT_NO = model.PD_CONTRACT_NO; }
private void getModel(PD_PROJECT_CONTRACT_Model model, PD_CONTRACT_CHANGE_Model c_model) { model.PD_PROJECT_CODE = this.txtPD_PROJECT_CODE.Value; model.PD_CONTRACT_TYPE = this.txtPD_CONTRACT_TYPE.SelectedValue; model.PD_CONTRACT_NO = this.txtPD_CONTRACT_NO.Value; model.PD_CONTRACT_COMPANY = this.txtPD_CONTRACT_COMPANY.Text; model.PD_CONTRACT_ASK_LIMIT = this.txtPD_CONTRACT_ASK_LIMIT.Text; model.PD_CONTRACT_ASK_PROCEED = this.txtPD_CONTRACT_ASK_PROCEED.Value; model.PD_CONTRACT_ASK_PAYMENT = this.txtPD_CONTRACT_ASK_PAYMENT.Text; model.PD_CONTRACT_NOTE = this.txtPD_CONTRACT_NOTE.Text; model.PD_CONTRACT_NAME = this.txtPD_CONTRACT_NAME.Text; model.PD_YEAR = this.ddlPD_YEAR.SelectedValue; if (PublicDal.PageValidate.IsDateTime(this.txtPD_CONTRACT_DATE.Value)) { model.PD_CONTRACT_DATE = DateTime.Parse(this.txtPD_CONTRACT_DATE.Value); } if (PublicDal.PageValidate.IsDecimal(this.txtPD_CONTRACT_MOENY.Value)) { decimal? nullable = model.PD_CONTRACT_MOENY; decimal num = decimal.Parse(this.txtPD_CONTRACT_MOENY.Value); c_model.PD_CONTRACT_CHANGE_MONEY = nullable.HasValue ? new decimal?(nullable.GetValueOrDefault() - num) : null; model.PD_CONTRACT_MOENY = new decimal?(decimal.Parse(this.txtPD_CONTRACT_MOENY.Value)); } this.GetQUOTA(model); if (PublicDal.PageValidate.IsDateTime(this.txtPD_CONTRACT_CHANGE_DATE.Value)) { c_model.PD_CONTRACT_CHANGE_DATE = new DateTime?(Convert.ToDateTime(this.txtPD_CONTRACT_CHANGE_DATE.Value.ToString())); } if (PublicDal.PageValidate.IsDecimal(this.txtPD_CONTRACT_MOENY.Value)) { c_model.PD_CONTRACT_CHANGE_MONEY = new decimal?(Convert.ToDecimal(this.txtPD_CONTRACT_MOENY.Value)); } c_model.PD_CONTRACT_NO = this.txtPD_CONTRACT_NO.Value; c_model.PD_CONTRACT_CHANGE_REASON = this.txtPD_CONTRACT_CHANGE_REASON.Value; c_model.PD_CONTRACT_CHANGE_TYPE = this.txtPD_CONTRACT_CHANGE_TYPE.SelectedValue; c_model.PD_CONTRACT_CHANGE_WH = this.txtPD_CONTRACT_CHANGE_WH.Value; c_model.PD_CONTRACT_TYPE = this.txtPD_CONTRACT_TYPE.SelectedValue; c_model.PD_PROJECT_CODE = model.PD_PROJECT_CODE; c_model.PD_CONTRACT_NO = model.PD_CONTRACT_NO; this.GetQUOTA(c_model); }
public void Add(PD_PROJECT_CONTRACT_Model model) { this.dal.Add(model); }
public bool Update(PD_PROJECT_CONTRACT_Model model) { return this.dal.Update(model); }
private List<PD_PROJECT_CONTRACT_Model> GetContractModel(string PD_PROJECT_CODE, ref string strErr) { List<PD_PROJECT_CONTRACT_Model> list = new List<PD_PROJECT_CONTRACT_Model>(); if (base.Request.Form["htgl_PD_CONTRACT_NO"] != null) { string[] strArray = base.Request.Form["htgl_PD_CONTRACT_NO"].Split(new char[] { ',' }); string[] strArray2 = base.Request.Form["htgl_PD_CONTRACT_NAME"].Split(new char[] { ',' }); string[] strArray3 = base.Request.Form["htgl_PD_CONTRACT_DATE"].Split(new char[] { ',' }); string[] strArray4 = base.Request.Form["htgl_PD_CONTRACT_COMPANY"].Split(new char[] { ',' }); string[] strArray5 = base.Request.Form["htgl_PD_CONTRACT_MOENY"].Split(new char[] { ',' }); string[] strArray6 = base.Request.Form["htgl_PD_CONTRACT_ASK_LIMIT"].Split(new char[] { ',' }); string[] strArray7 = base.Request.Form["htgl_PD_CONTRACT_ASK_PROCEED"].Split(new char[] { ',' }); string[] strArray8 = base.Request.Form["htgl_PD_CONTRACT_ASK_PAYMENT"].Split(new char[] { ',' }); string[] strArray9 = base.Request.Form["htgl_PD_CONTRACT_NOTE"].Split(new char[] { ',' }); DataSet set = null; DataView defaultView = null; string s = base.Server.UrlDecode(this.FilePostCtr1.getFileName); if ((s != null) && (s.Trim() != "")) { set = new DataSet(); XmlTextReader reader = new XmlTextReader(new StringReader(s)); set.ReadXml(reader); } if ((set != null) && (set.Tables.Count > 0)) { defaultView = set.Tables[0].DefaultView; } for (int i = 0; i < strArray.Length; i++) { PD_PROJECT_CONTRACT_Model item = new PD_PROJECT_CONTRACT_Model { PD_PROJECT_CODE = PD_PROJECT_CODE, PD_CONTRACT_NAME = strArray2[i], PD_CONTRACT_NO = strArray[i], PD_CONTRACT_DATE = DateTime.Parse(strArray3[i]), PD_CONTRACT_COMPANY = strArray4[i], PD_CONTRACT_MOENY = new decimal?(int.Parse(strArray5[i])), PD_CONTRACT_ASK_LIMIT = strArray6[i], PD_CONTRACT_ASK_PROCEED = strArray7[i], PD_CONTRACT_ASK_PAYMENT = strArray8[i] }; if (defaultView != null) { item.PD_CONTRACT_NOTE = strArray9[i]; defaultView.RowFilter = " tableID='table_htgl' and rowIndex=" + (i + 1); if (defaultView.Count > 0) { item.PD_CONTRACT_FILENAME = defaultView[0]["FileName"].ToString(); item.PD_CONTRACT_FILENAME_SYSTEM = defaultView[0]["FileSysName"].ToString(); } } list.Add(item); } } return list; }