public virtual void Remove(MER_HOPDONG_DV b) { try { db.MER_HOPDONG_DVs.DeleteOnSubmit(b); db.SubmitChanges(); } catch (Exception e) { throw new Exception(e.Message); } }
public virtual void Create(MER_HOPDONG_DV cus) { try { this.db.MER_HOPDONG_DVs.InsertOnSubmit(cus); db.SubmitChanges(); } catch //(Exception e) { //throw new Exception(e.Message); } }
public virtual void Remove(int id) { try { MER_HOPDONG_DV b = this.GetById(id); this.Remove(b); } catch (Exception e) { throw new Exception(e.Message); } }
public virtual void Remove(MER_HOPDONG_DV b) { try { db.MER_HOPDONG_DVs.DeleteOnSubmit(b); db.SubmitChanges(); } catch (Exception e) { throw new Exception(e.Message); } }
public virtual void Create(MER_HOPDONG_DV cus) { try { this.db.MER_HOPDONG_DVs.InsertOnSubmit(cus); db.SubmitChanges(); } catch //(Exception e) { //throw new Exception(e.Message); } }
public virtual void Update(MER_HOPDONG_DV cus) { try { MER_HOPDONG_DV cusOld = this.GetById(cus.ID); cusOld = cus; db.SubmitChanges(); } catch //(Exception e) { //throw new Exception(e.Message); } }
public virtual void Update(MER_HOPDONG_DV cus) { try { MER_HOPDONG_DV cusOld = this.GetById(cus.ID); cusOld = cus; db.SubmitChanges(); } catch //(Exception e) { //throw new Exception(e.Message); } }
private void Save_Data(string strLink = "") { try { if (_id == 0) { int _idUser = Utils.CIntDef(HttpContext.Current.Request.Cookies["PITM_INFO"]["PITM_USER_ID"]); MER_HOPDONG_DV i = new MER_HOPDONG_DV(); i.USER_ID = _idUser; i.MER_POS01 = txtMerPos01.Text.Trim(); i.MER_POS02 = txtMerPos02.Text.Trim(); i.MER_POS03 = txtMerPos03.Text.Trim(); i.MER_POS04 = txtMerPos04.Text.Trim(); i.MER_POS05 = txtMerPos05.Text.Trim(); i.MER_NAME = ConvertString(txtMerName.Text.ToUpper().Trim()); i.MER_ADDRESS = txtMerAddress.Text.Trim(); i.MER_PHONE = txtMerPhone.Text.Trim(); i.MER_TAXCODE = txtMerTaxCode.Text.Trim(); i.MER_EMAIL = txtMerEmail.Text.Trim(); i.MER_NX = ddlDanhXung.SelectedValue; string sNguoiDD = ToFirstUpper(txtMerRepresent.Text.Trim()); i.MER_REPRESENT = ConvertStringNDD(sNguoiDD); i.MER_POSITION = ToFirstUpper(txtMerPosition.Text.Trim()); i.MER_COST_TITLE01 = txtMerCostTitle01.Text.Trim(); i.MER_COST_TITLE02 = txtMerCostTitle02.Text.Trim(); i.MER_COST_TITLE03 = txtMerCostTitle03.Text.Trim(); i.MER_COST_DETAIL = txtMerCostDetail.Text.Trim(); i.MER_BEGIN_M = txtMerBeginM.Text.Trim(); i.MER_DEADLINE_INT = txtMerDeadlineInt.Text.Trim(); i.MER_DEADLINE_STRING = txtMerDeadlineString.Text.ToLower().Trim(); i.MER_DATE = DateTime.Now; i.MER_STATUS = 0; //Biểu phí i.PHI_HANGTHANG = Utils.CIntDef(txtPhiHangThang.Text.Replace(",", "")); i.PHI_TU1_1 = Utils.CIntDef(txtTu1_1.Text.Replace(",", "")); i.PHI_TU1_2 = Utils.CIntDef(txtTu1_2.Text.Replace(",", "")); i.PHI_HD1 = Utils.CIntDef(txtPhi1.Text.Replace(",", "")); i.PHI_TU2_1 = Utils.CIntDef(txtTu2_1.Text.Replace(",", "")); i.PHI_TU2_2 = Utils.CIntDef(txtTu2_2.Text.Replace(",", "")); i.PHI_HD2 = Utils.CIntDef(txtPhi2.Text.Replace(",", "")); i.PHI_TU3_1 = Utils.CIntDef(txtTu3_1.Text.Replace(",", "")); i.PHI_TU3_2 = Utils.CIntDef(txtTu3_2.Text.Replace(",", "")); i.PHI_HD3 = Utils.CIntDef(txtPhi3.Text.Replace(",", "")); i.PHI_TU4_1 = Utils.CIntDef(txtTu4_1.Text.Replace(",", "")); i.PHI_TU4_2 = Utils.CIntDef(txtTu4_2.Text.Replace(",", "")); i.PHI_HD4 = Utils.CIntDef(txtPhi4.Text.Replace(",", "")); i.PHI_TU5_1 = Utils.CIntDef(txtTu5_1.Text.Replace(",", "")); i.PHI_TU5_2 = Utils.CIntDef(txtTu5_2.Text.Replace(",", "")); i.PHI_HD5 = Utils.CIntDef(txtPhi5.Text.Replace(",", "")); i.PHI_TU6_1 = Utils.CIntDef(txtTu6_1.Text.Replace(",", "")); i.PHI_TU6_2 = Utils.CIntDef(txtTu6_2.Text.Replace(",", "")); i.PHI_HD6 = Utils.CIntDef(txtPhi6.Text.Replace(",", "")); i.PHI_THEMPHI = Utils.CIntDef(txtThemPhi.Text.Replace(",", "")); i.PHI_THEMHD = Utils.CIntDef(txtThemHd.Text.Replace(",", "")); _MerHopDongDVData.Create(i); db.SubmitChanges(); var getlink = db.MER_HOPDONG_DVs.OrderByDescending(n => n.ID).Take(1).ToList(); if (getlink.Count > 0) { strLink = string.IsNullOrEmpty(strLink) ? "hop-dong-ke-toan.aspx?id=" + getlink[0].ID : strLink; Save_FileDoc(getlink[0].ID); } //Gửi mail string _nameUser = HttpContext.Current.Request.Cookies["PITM_INFO"]["PITM_USER_NAME"]; string _merSo = txtMerPos01.Text.Trim() + "/HĐTV/" + txtMerPos02.Text.Trim(); string _merNgay = "Ngày " + txtMerPos03.Text.Trim() + " tháng " + txtMerPos04.Text.Trim() + " năm " + txtMerPos05.Text.Trim(); string _merPhiTemp = ""; string[] lines = System.Text.RegularExpressions.Regex.Split(txtMerCostDetail.Text, "\r\n"); foreach (string line in lines) { if (line != "") { _merPhiTemp += line + "<br />"; } } string _merPhi = "-" + txtMerCostTitle01.Text.Trim() + "<br />" + _merPhiTemp + "-" + txtMerCostTitle02.Text.Trim() + "<br />" + "-" + txtMerCostTitle03.Text.Trim(); SendEmail(24, _nameUser, _merSo, _merNgay, ConvertString(txtMerName.Text.ToUpper().Trim()), ToFirstUpper(txtMerAddress.Text.Trim()), txtMerPhone.Text.Trim() , txtMerTaxCode.Text.Trim(), txtMerEmail.Text.Trim(), ToFirstUpper(txtMerRepresent.Text.Trim()), ToFirstUpper(txtMerPosition.Text.Trim()) , _merPhi, txtMerBeginM.Text.Trim(), txtMerDeadlineInt.Text.Trim() + " (" + txtMerDeadlineString.Text.Trim() + ")"); if (!string.IsNullOrEmpty(strLink)) { string strScript = "<script>"; strScript += "alert('Hợp đồng dịch vụ kế toán đã cập nhật thành công!');"; strScript += "window.location='" + strLink + "';"; strScript += "</script>"; Page.RegisterClientScriptBlock("strScript", strScript); } } else { var obj = db.MER_HOPDONG_DVs.Where(n => n.ID == _id).ToList(); foreach (var i in obj) { i.MER_POS01 = txtMerPos01.Text.Trim(); i.MER_POS02 = txtMerPos02.Text.Trim(); i.MER_POS03 = txtMerPos03.Text.Trim(); i.MER_POS04 = txtMerPos04.Text.Trim(); i.MER_POS05 = txtMerPos05.Text.Trim(); i.MER_NAME = ConvertString(txtMerName.Text.ToUpper().Trim()); i.MER_ADDRESS = txtMerAddress.Text.Trim(); i.MER_PHONE = txtMerPhone.Text.Trim(); i.MER_TAXCODE = txtMerTaxCode.Text.Trim(); i.MER_EMAIL = txtMerEmail.Text.Trim(); i.MER_NX = ddlDanhXung.SelectedValue; string sNguoiDD = ToFirstUpper(txtMerRepresent.Text.Trim()); i.MER_REPRESENT = ConvertStringNDD(sNguoiDD); i.MER_POSITION = ToFirstUpper(txtMerPosition.Text.Trim()); i.MER_COST_TITLE01 = txtMerCostTitle01.Text.Trim(); i.MER_COST_TITLE02 = txtMerCostTitle02.Text.Trim(); i.MER_COST_TITLE03 = txtMerCostTitle03.Text.Trim(); i.MER_COST_DETAIL = txtMerCostDetail.Text.Trim(); i.MER_BEGIN_M = txtMerBeginM.Text.Trim(); i.MER_DEADLINE_INT = txtMerDeadlineInt.Text.Trim(); i.MER_DEADLINE_STRING = txtMerDeadlineString.Text.ToLower().Trim(); if (i.MER_STATUS == 2) { i.MER_STATUS = 0; i.MER_CHI_CHU = "Đã sửa lại hợp đồng"; } //Biểu phí i.PHI_HANGTHANG = Utils.CIntDef(txtPhiHangThang.Text.Replace(",", "")); i.PHI_TU1_1 = Utils.CIntDef(txtTu1_1.Text.Replace(",", "")); i.PHI_TU1_2 = Utils.CIntDef(txtTu1_2.Text.Replace(",", "")); i.PHI_HD1 = Utils.CIntDef(txtPhi1.Text.Replace(",", "")); i.PHI_TU2_1 = Utils.CIntDef(txtTu2_1.Text.Replace(",", "")); i.PHI_TU2_2 = Utils.CIntDef(txtTu2_2.Text.Replace(",", "")); i.PHI_HD2 = Utils.CIntDef(txtPhi2.Text.Replace(",", "")); i.PHI_TU3_1 = Utils.CIntDef(txtTu3_1.Text.Replace(",", "")); i.PHI_TU3_2 = Utils.CIntDef(txtTu3_2.Text.Replace(",", "")); i.PHI_HD3 = Utils.CIntDef(txtPhi3.Text.Replace(",", "")); i.PHI_TU4_1 = Utils.CIntDef(txtTu4_1.Text.Replace(",", "")); i.PHI_TU4_2 = Utils.CIntDef(txtTu4_2.Text.Replace(",", "")); i.PHI_HD4 = Utils.CIntDef(txtPhi4.Text.Replace(",", "")); i.PHI_TU5_1 = Utils.CIntDef(txtTu5_1.Text.Replace(",", "")); i.PHI_TU5_2 = Utils.CIntDef(txtTu5_2.Text.Replace(",", "")); i.PHI_HD5 = Utils.CIntDef(txtPhi5.Text.Replace(",", "")); i.PHI_TU6_1 = Utils.CIntDef(txtTu6_1.Text.Replace(",", "")); i.PHI_TU6_2 = Utils.CIntDef(txtTu6_2.Text.Replace(",", "")); i.PHI_HD6 = Utils.CIntDef(txtPhi6.Text.Replace(",", "")); i.PHI_THEMPHI = Utils.CIntDef(txtThemPhi.Text.Replace(",", "")); i.PHI_THEMHD = Utils.CIntDef(txtThemHd.Text.Replace(",", "")); _MerHopDongDVData.Update(i); db.SubmitChanges(); } strLink = string.IsNullOrEmpty(strLink) ? "hop-dong-ke-toan.aspx?id=" + _id : strLink; Save_FileDoc(_id); if (!string.IsNullOrEmpty(strLink)) { string strScript = "<script>"; strScript += "alert('Hợp đồng dịch vụ kế toán đã cập nhật thành công!');"; strScript += "window.location='" + strLink + "';"; strScript += "</script>"; Page.RegisterClientScriptBlock("strScript", strScript); } } } catch (Exception) { throw; } }
private void Save_Data(string strLink = "") { try { if (_id == 0) { int _idUser = Utils.CIntDef(HttpContext.Current.Request.Cookies["PITM_INFO"]["PITM_USER_ID"]); MER_HOPDONG_DV i = new MER_HOPDONG_DV(); i.USER_ID = _idUser; i.MER_POS01 = txtMerPos01.Text.Trim(); i.MER_POS02 = txtMerPos02.Text.Trim(); i.MER_POS03 = txtMerPos03.Text.Trim(); i.MER_POS04 = txtMerPos04.Text.Trim(); i.MER_POS05 = txtMerPos05.Text.Trim(); i.MER_NAME = ConvertString(txtMerName.Text.ToUpper().Trim()); i.MER_ADDRESS = txtMerAddress.Text.Trim(); i.MER_PHONE = txtMerPhone.Text.Trim(); i.MER_TAXCODE = txtMerTaxCode.Text.Trim(); i.MER_EMAIL = txtMerEmail.Text.Trim(); i.MER_NX = ddlDanhXung.SelectedValue; string sNguoiDD = ToFirstUpper(txtMerRepresent.Text.Trim()); i.MER_REPRESENT = ConvertStringNDD(sNguoiDD); i.MER_POSITION = ToFirstUpper(txtMerPosition.Text.Trim()); i.MER_COST_TITLE01 = txtMerCostTitle01.Text.Trim(); i.MER_COST_TITLE02 = txtMerCostTitle02.Text.Trim(); i.MER_COST_TITLE03 = txtMerCostTitle03.Text.Trim(); i.MER_COST_DETAIL = txtMerCostDetail.Text.Trim(); i.MER_BEGIN_M = txtMerBeginM.Text.Trim(); i.MER_DEADLINE_INT = txtMerDeadlineInt.Text.Trim(); i.MER_DEADLINE_STRING = txtMerDeadlineString.Text.ToLower().Trim(); i.MER_DATE = DateTime.Now; i.MER_STATUS = 0; //Biểu phí i.PHI_HANGTHANG = Utils.CIntDef(txtPhiHangThang.Text.Replace(",", "")); i.PHI_TU1_1 = Utils.CIntDef(txtTu1_1.Text.Replace(",", "")); i.PHI_TU1_2 = Utils.CIntDef(txtTu1_2.Text.Replace(",", "")); i.PHI_HD1 = Utils.CIntDef(txtPhi1.Text.Replace(",", "")); i.PHI_TU2_1 = Utils.CIntDef(txtTu2_1.Text.Replace(",", "")); i.PHI_TU2_2 = Utils.CIntDef(txtTu2_2.Text.Replace(",", "")); i.PHI_HD2 = Utils.CIntDef(txtPhi2.Text.Replace(",", "")); i.PHI_TU3_1 = Utils.CIntDef(txtTu3_1.Text.Replace(",", "")); i.PHI_TU3_2 = Utils.CIntDef(txtTu3_2.Text.Replace(",", "")); i.PHI_HD3 = Utils.CIntDef(txtPhi3.Text.Replace(",", "")); i.PHI_TU4_1 = Utils.CIntDef(txtTu4_1.Text.Replace(",", "")); i.PHI_TU4_2 = Utils.CIntDef(txtTu4_2.Text.Replace(",", "")); i.PHI_HD4 = Utils.CIntDef(txtPhi4.Text.Replace(",", "")); i.PHI_TU5_1 = Utils.CIntDef(txtTu5_1.Text.Replace(",", "")); i.PHI_TU5_2 = Utils.CIntDef(txtTu5_2.Text.Replace(",", "")); i.PHI_HD5 = Utils.CIntDef(txtPhi5.Text.Replace(",", "")); i.PHI_TU6_1 = Utils.CIntDef(txtTu6_1.Text.Replace(",", "")); i.PHI_TU6_2 = Utils.CIntDef(txtTu6_2.Text.Replace(",", "")); i.PHI_HD6 = Utils.CIntDef(txtPhi6.Text.Replace(",", "")); i.PHI_THEMPHI = Utils.CIntDef(txtThemPhi.Text.Replace(",", "")); i.PHI_THEMHD = Utils.CIntDef(txtThemHd.Text.Replace(",", "")); _MerHopDongDVData.Create(i); db.SubmitChanges(); var getlink = db.MER_HOPDONG_DVs.OrderByDescending(n => n.ID).Take(1).ToList(); if (getlink.Count > 0) { strLink = string.IsNullOrEmpty(strLink) ? "hop-dong-ke-toan.aspx?id=" + getlink[0].ID : strLink; Save_FileDoc(getlink[0].ID); } //Gửi mail string _nameUser = HttpContext.Current.Request.Cookies["PITM_INFO"]["PITM_USER_NAME"]; string _merSo = txtMerPos01.Text.Trim() + "/HĐTV/" + txtMerPos02.Text.Trim(); string _merNgay = "Ngày "+txtMerPos03.Text.Trim()+" tháng "+txtMerPos04.Text.Trim() +" năm "+ txtMerPos05.Text.Trim(); string _merPhiTemp = ""; string[] lines = System.Text.RegularExpressions.Regex.Split(txtMerCostDetail.Text, "\r\n"); foreach (string line in lines) { if (line != "") _merPhiTemp += line + "<br />" ; } string _merPhi = "-" + txtMerCostTitle01.Text.Trim() + "<br />" + _merPhiTemp + "-" + txtMerCostTitle02.Text.Trim() + "<br />" + "-" + txtMerCostTitle03.Text.Trim(); SendEmail(24, _nameUser, _merSo, _merNgay, ConvertString(txtMerName.Text.ToUpper().Trim()), ToFirstUpper(txtMerAddress.Text.Trim()), txtMerPhone.Text.Trim() , txtMerTaxCode.Text.Trim(), txtMerEmail.Text.Trim(), ToFirstUpper(txtMerRepresent.Text.Trim()), ToFirstUpper(txtMerPosition.Text.Trim()) , _merPhi, txtMerBeginM.Text.Trim(), txtMerDeadlineInt.Text.Trim() + " (" + txtMerDeadlineString.Text.Trim() + ")"); if (!string.IsNullOrEmpty(strLink)) { string strScript = "<script>"; strScript += "alert('Hợp đồng dịch vụ kế toán đã cập nhật thành công!');"; strScript += "window.location='" + strLink + "';"; strScript += "</script>"; Page.RegisterClientScriptBlock("strScript", strScript); } } else { var obj = db.MER_HOPDONG_DVs.Where(n => n.ID == _id).ToList(); foreach (var i in obj) { i.MER_POS01 = txtMerPos01.Text.Trim(); i.MER_POS02 = txtMerPos02.Text.Trim(); i.MER_POS03 = txtMerPos03.Text.Trim(); i.MER_POS04 = txtMerPos04.Text.Trim(); i.MER_POS05 = txtMerPos05.Text.Trim(); i.MER_NAME = ConvertString(txtMerName.Text.ToUpper().Trim()); i.MER_ADDRESS = txtMerAddress.Text.Trim(); i.MER_PHONE = txtMerPhone.Text.Trim(); i.MER_TAXCODE = txtMerTaxCode.Text.Trim(); i.MER_EMAIL = txtMerEmail.Text.Trim(); i.MER_NX = ddlDanhXung.SelectedValue; string sNguoiDD = ToFirstUpper(txtMerRepresent.Text.Trim()); i.MER_REPRESENT = ConvertStringNDD(sNguoiDD); i.MER_POSITION = ToFirstUpper(txtMerPosition.Text.Trim()); i.MER_COST_TITLE01 = txtMerCostTitle01.Text.Trim(); i.MER_COST_TITLE02 = txtMerCostTitle02.Text.Trim(); i.MER_COST_TITLE03 = txtMerCostTitle03.Text.Trim(); i.MER_COST_DETAIL = txtMerCostDetail.Text.Trim(); i.MER_BEGIN_M = txtMerBeginM.Text.Trim(); i.MER_DEADLINE_INT = txtMerDeadlineInt.Text.Trim(); i.MER_DEADLINE_STRING = txtMerDeadlineString.Text.ToLower().Trim(); if (i.MER_STATUS == 2) { i.MER_STATUS = 0; i.MER_CHI_CHU = "Đã sửa lại hợp đồng"; } //Biểu phí i.PHI_HANGTHANG = Utils.CIntDef(txtPhiHangThang.Text.Replace(",", "")); i.PHI_TU1_1 = Utils.CIntDef(txtTu1_1.Text.Replace(",", "")); i.PHI_TU1_2 = Utils.CIntDef(txtTu1_2.Text.Replace(",", "")); i.PHI_HD1 = Utils.CIntDef(txtPhi1.Text.Replace(",", "")); i.PHI_TU2_1 = Utils.CIntDef(txtTu2_1.Text.Replace(",", "")); i.PHI_TU2_2 = Utils.CIntDef(txtTu2_2.Text.Replace(",", "")); i.PHI_HD2 = Utils.CIntDef(txtPhi2.Text.Replace(",", "")); i.PHI_TU3_1 = Utils.CIntDef(txtTu3_1.Text.Replace(",", "")); i.PHI_TU3_2 = Utils.CIntDef(txtTu3_2.Text.Replace(",", "")); i.PHI_HD3 = Utils.CIntDef(txtPhi3.Text.Replace(",", "")); i.PHI_TU4_1 = Utils.CIntDef(txtTu4_1.Text.Replace(",", "")); i.PHI_TU4_2 = Utils.CIntDef(txtTu4_2.Text.Replace(",", "")); i.PHI_HD4 = Utils.CIntDef(txtPhi4.Text.Replace(",", "")); i.PHI_TU5_1 = Utils.CIntDef(txtTu5_1.Text.Replace(",", "")); i.PHI_TU5_2 = Utils.CIntDef(txtTu5_2.Text.Replace(",", "")); i.PHI_HD5 = Utils.CIntDef(txtPhi5.Text.Replace(",", "")); i.PHI_TU6_1 = Utils.CIntDef(txtTu6_1.Text.Replace(",", "")); i.PHI_TU6_2 = Utils.CIntDef(txtTu6_2.Text.Replace(",", "")); i.PHI_HD6 = Utils.CIntDef(txtPhi6.Text.Replace(",", "")); i.PHI_THEMPHI = Utils.CIntDef(txtThemPhi.Text.Replace(",", "")); i.PHI_THEMHD = Utils.CIntDef(txtThemHd.Text.Replace(",", "")); _MerHopDongDVData.Update(i); db.SubmitChanges(); } strLink = string.IsNullOrEmpty(strLink) ? "hop-dong-ke-toan.aspx?id=" + _id : strLink; Save_FileDoc(_id); if (!string.IsNullOrEmpty(strLink)) { string strScript = "<script>"; strScript += "alert('Hợp đồng dịch vụ kế toán đã cập nhật thành công!');"; strScript += "window.location='" + strLink + "';"; strScript += "</script>"; Page.RegisterClientScriptBlock("strScript", strScript); } } } catch (Exception){throw;} }