protected void Page_Load(object sender, EventArgs e) { hidId.Value = Func.ParseString(Request["id"]); if (!IsPostBack) { PopupWidth = 600; PopupHeight = 450; CustomerData data = new CustomerData(); ITransaction tran = factory.GetLoadObject(data, hidId.Value); Execute(tran); if (!HasError) { //Get Data data = (CustomerData)tran.Result; lblCustomerId.Text = data.CustomerId; lblName.Text = data.Name; } for (int i = 2010; i < 2050; i++) { drpYear.Items.Add(new System.Web.UI.WebControls.ListItem(Func.ParseString(i), Func.ParseString(i))); } drpYear.Items.FindByValue(DateTime.Now.AddMonths(-1).ToString("yyyy")).Selected = true; for (int i = 1; i < 13; i++) { drpMonth.Items.Add(new System.Web.UI.WebControls.ListItem(Func.ParseString(i).PadLeft(2, '0'), Func.ParseString(i).PadLeft(2, '0'))); } drpMonth.Items.FindByValue(DateTime.Now.AddMonths(-1).ToString("MM")).Selected = true; //string YearMonths = DbHelper.GetScalar("Select YearMonths from PaymentBillInfo where customerid = '" + hidId.Value + "' and YearMonth = '" + drpYear.SelectedValue + drpMonth.SelectedValue + "' and BuildingId= '" + Func.ParseString(Session["__BUILDINGID__"]) + "'"); //for (int i = -6; i < 6; i++) //{ // if (YearMonths.IndexOf(DateTime.Now.AddMonths(i).ToString("MM/yyyy")) < 0) // { // lstYearMonth.Items.Add(new ListItem(DateTime.Now.AddMonths(i).ToString("MM/yyyy"), DateTime.Now.AddMonths(i).ToString("yyyyMM"))); // } // else // { // lstSelectedYearMonth.Items.Add(new ListItem(DateTime.Now.AddMonths(i).ToString("MM/yyyy"), DateTime.Now.AddMonths(i).ToString("yyyyMM"))); // } //} ShowData(); } }
/// <summary> /// Load data /// </summary> private void LoadData() { CustomerData data = new CustomerData(); ITransaction tran = factory.GetLoadObject(data, id); Execute(tran); if (!HasError) { //Get Data data = (CustomerData)tran.Result; lblCustomerId.Text = data.CustomerId; txtName.Text = data.Name; txtContactName.Text = data.ContactName; ShowData(); for (int i = 2010; i < 2050; i++) { drpYear.Items.Add(new System.Web.UI.WebControls.ListItem(Func.ParseString(i), Func.ParseString(i))); } drpYear.Items.Add(new ListItem("", "")); drpYear.Text = ""; //drpYear.Items.FindByValue(DateTime.Now.AddMonths(-1).ToString("yyyy")).Selected = true; for (int i = 1; i < 13; i++) { drpMonth.Items.Add(new System.Web.UI.WebControls.ListItem(Func.ParseString(i).PadLeft(2, '0'), Func.ParseString(i).PadLeft(2, '0'))); } drpMonth.Items.Add(new ListItem("", "")); drpMonth.Text = ""; //drpMonth.Items.FindByValue(DateTime.Now.AddMonths(-1).ToString("MM")).Selected = true; ShowData(); } }
protected void Page_Load(object sender, EventArgs e) { hidId.Value = Func.ParseString(Request["id"]); if (!IsPostBack) { PopupWidth = 600; PopupHeight = 450; CustomerData data = new CustomerData(); ITransaction tran = factory.GetLoadObject(data, hidId.Value); Execute(tran); if (!HasError) { //Get Data data = (CustomerData)tran.Result; lblCustomerId.Text = data.CustomerId; lblName.Text = data.Name; } for (int i = 2010; i < 2050; i++) { drpYear.Items.Add(new System.Web.UI.WebControls.ListItem(Func.ParseString(i), Func.ParseString(i))); } drpYear.Items.FindByValue(DateTime.Now.AddMonths(-1).ToString("yyyy")).Selected = true; for (int i = 1; i < 13; i++) { drpMonth.Items.Add(new System.Web.UI.WebControls.ListItem(Func.ParseString(i).PadLeft(2, '0'), Func.ParseString(i).PadLeft(2, '0'))); } drpMonth.Items.FindByValue(DateTime.Now.AddMonths(-1).ToString("MM")).Selected = true; ShowData(drpYear.SelectedValue + drpMonth.SelectedValue); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { CustomerData data = new CustomerData(); ITransaction tran = factory.GetLoadObject(data, Func.ParseString(Request["id"])); Execute(tran); if (!HasError) { //Get Data data = (CustomerData)tran.Result; txtName.Text = data.Name; txtContactName.Text = data.ContactName; txtCustomerId.Text = data.CustomerId; } //txtName.Text = DbHelper.GetScalar("Select Name from Customer Where BuildingId = '" + Func.ParseString(Session["__BUILDINGID__"]) + "' and CustomerId = '" + txtCustomerId.Text + "'"); //txtContactName.Text = DbHelper.GetScalar("Select ContactName from Customer Where BuildingId = '" + Func.ParseString(Session["__BUILDINGID__"]) + "' and CustomerId = '" + txtCustomerId.Text + "'"); for (int i = -6; i < 12; i++) { lstYearMonth.Items.Add(new ListItem(DateTime.Now.AddMonths(i).ToString("MM/yyyy"), DateTime.Now.AddMonths(i).ToString("yyyyMM"))); } //DbHelper.FillList(drpPaymentType, "Select * from Mst_PaymentType Where specialPay = 1 and delflag = '0'", "Name", "id"); } }
protected void Page_Load(object sender, EventArgs e) { hidId.Value = Func.ParseString(Request["id"]); if (!IsPostBack) { PopupWidth = 600; PopupHeight = 450; CustomerData data = new CustomerData(); ITransaction tran = factory.GetLoadObject(data, hidId.Value); Execute(tran); if (!HasError) { //Get Data data = (CustomerData)tran.Result; lblCustomerId.Text = data.CustomerId; lblName.Text = data.Name; } for (int i = 2010; i < 2050; i++) { drpYear.Items.Add(new System.Web.UI.WebControls.ListItem(Func.ParseString(i), Func.ParseString(i))); } drpYear.Items.FindByValue(DateTime.Now.AddMonths(-1).ToString("yyyy")).Selected = true; for (int i = 1; i < 13; i++) { drpMonth.Items.Add(new System.Web.UI.WebControls.ListItem(Func.ParseString(i).PadLeft(2, '0'), Func.ParseString(i).PadLeft(2, '0'))); } drpMonth.Items.FindByValue(DateTime.Now.AddMonths(-1).ToString("MM")).Selected = true; ShowData(drpYear.SelectedValue + drpMonth.SelectedValue); //String[] chkText = new String[12] { "", "", "", "", "", "", "", "", "", "", "", ""}; //DateTime monthYear = DateTime.Now.AddMonths(-6); //for (int i = 0; i < 12; i++) //{ // monthYear = monthYear.AddMonths(1); // chkText[i] = monthYear.ToString("MM") + "/" + monthYear.ToString("yyyy"); //} //chkMonth01.Text = chkText[0]; //chkMonth02.Text = chkText[1]; //chkMonth03.Text = chkText[2]; //chkMonth04.Text = chkText[3]; //chkMonth05.Text = chkText[4]; //chkMonth06.Text = chkText[5]; //chkMonth07.Text = chkText[6]; //chkMonth08.Text = chkText[7]; //chkMonth09.Text = chkText[8]; //chkMonth10.Text = chkText[9]; //chkMonth11.Text = chkText[10]; //chkMonth12.Text = chkText[11]; for (int i = -6; i < 6; i++) { lstYearMonth.Items.Add(new ListItem(DateTime.Now.AddMonths(i).ToString("MM/yyyy"), DateTime.Now.AddMonths(i).ToString("yyyyMM"))); } } }
/// <summary> /// Load data /// </summary> private void LoadData() { CustomerData data = new CustomerData(); ITransaction tran = factory.GetLoadObject(data, id); Execute(tran); if (!HasError) { //Get Data data = (CustomerData)tran.Result; txtId.Text = data.CustomerId; txtName.Text = data.Name; txtPhone.Text = data.Phone; txtEmail.Text = data.Email; txtContactName.Text = data.ContactName; txtComment.Text = data.Comment; chkDelFlag.Checked = "1".Equals(data.DelFlag) ? false : true; lblCreated.Text = !"".Equals(data.Created) ? data.CreatedBy + "(" + Func.Formatdmyhms(data.Created) + ")" : ""; lblModified.Text = !"".Equals(data.Modified) ? data.ModifiedBy + "(" + Func.Formatdmyhms(data.Modified) + ")" : ""; rdoMonthPaymentTypeFirst.Checked = data.MonthPaymentType.Equals("1") ? true : false; rdoMonthPaymentTypeLast.Checked = data.MonthPaymentType.Equals("2") ? true : false; } }
/// <summary> /// Update /// </summary> private void UpdateData() { CustomerData data = new CustomerData(); ITransaction tran = factory.GetLoadObject(data, hidId.Value); Execute(tran); if (!HasError) { //Get Data data = (CustomerData)tran.Result; data.Name = txtName.Text.Trim(); data.Phone = txtPhone.Text.Trim(); data.Email = txtEmail.Text.Trim(); data.ContactName = txtContactName.Text.Trim(); data.Comment = txtComment.Text.Trim(); data.ModifiedBy = Page.User.Identity.Name; data.CreatedBy = Page.User.Identity.Name; data.Created = DateTime.Now.ToString("yyyyMMddHHmmss"); data.Modified = DateTime.Now.ToString("yyyyMMddHHmmss"); data.DelFlag = true.Equals(chkDelFlag.Checked) ? "0" : "1"; data.MonthPaymentType = rdoMonthPaymentTypeFirst.Checked ? "1" : "2"; tran = factory.GetUpdateObject(data); Execute(tran); if (!HasError) { OperationLogger.WriteInfo(Constants.LogOperationAlbumId, Constants.LogActionUpdateId, updateSuccess, Page.User.Identity.Name); mvMessage.SetCompleteMessage(updateSuccess); ScriptManager.RegisterClientScriptBlock(this.btnRegister, this.GetType(), key, postback, true); lblCreated.Text = !"".Equals(data.Created) ? data.CreatedBy + "(" + Func.Formatdmyhms(data.Created) + ")" : ""; lblModified.Text = !"".Equals(data.Modified) ? data.ModifiedBy + "(" + Func.Formatdmyhms(data.Modified) + ")" : ""; } else { OperationLogger.WriteError(Constants.LogOperationAlbumId, Constants.LogActionUpdateId, updateUnSuccess, Page.User.Identity.Name); mvMessage.AddError(updateUnSuccess); } } }
/// <summary> /// Insert data /// </summary> private void InsertData() { //Get and Insert Data CustomerData data = new CustomerData(); ITransaction tran = factory.GetInsertObject(data); data.CustomerId = txtId.Text.Trim(); data.Name = txtName.Text.Trim(); data.Phone = txtPhone.Text.Trim(); data.Email = txtEmail.Text.Trim(); data.ContactName = txtContactName.Text.Trim(); data.Comment = txtComment.Text.Trim(); data.ModifiedBy = Page.User.Identity.Name; data.CreatedBy = Page.User.Identity.Name; data.Created = DateTime.Now.ToString("yyyyMMddHHmmss"); data.Modified = DateTime.Now.ToString("yyyyMMddHHmmss"); data.DelFlag = true.Equals(chkDelFlag.Checked) ? "0" : "1"; data.CustomerId = txtId.Text; data.BuildingId = Func.ParseString(Session["__BUILDINGID__"]); data.MonthPaymentType = rdoMonthPaymentTypeFirst.Checked ? "1" : "2"; Execute(tran); if (!HasError) { OperationLogger.WriteInfo(Constants.LogOperationAlbumId, Constants.LogActionInsertId, addSuccess, Page.User.Identity.Name); mvMessage.SetCompleteMessage(addSuccess); ScriptManager.RegisterClientScriptBlock(this.btnRegister, this.GetType(), key, postback, true); btnRegister.CommandName = "Register"; hidAction.Value = "Edit"; txtId.Enabled = false; lblCreated.Text = !"".Equals(data.Created) ? data.CreatedBy + "(" + Func.Formatdmyhms(data.Created) + ")" : ""; lblModified.Text = !"".Equals(data.Modified) ? data.ModifiedBy + "(" + Func.Formatdmyhms(data.Modified) + ")" : ""; } else { OperationLogger.WriteError(Constants.LogOperationAlbumId, Constants.LogActionInsertId, addUnSuccess, Page.User.Identity.Name); mvMessage.AddError(addUnSuccess); } }
protected void Page_Load(object sender, EventArgs e) { hidId.Value = Func.ParseString(Request["id"]); hidYearMonth.Value = Func.ParseString(Request["yearmonth"]); hidPaymentType.Value = Func.ParseString(Request["paymenttype"]); hidExchangeType.Value = Func.ParseString(Request["exchangetype"]); hidBookingId.Value = Func.ParseString(Request["bookingid"]); txtMoney.Text = Func.ParseString(Request["money"]); if (!IsPostBack) { ShowData(hidYearMonth.Value); CustomerData data = new CustomerData(); ITransaction tran = factory.GetLoadObject(data, hidId.Value); Execute(tran); if (!HasError) { //Get Data data = (CustomerData)tran.Result; txtCustomerId.Text = data.CustomerId; txtName.Text = data.Name; //txtComment.Text = data.Comment; txtContactName.Text = data.ContactName; } lblMoney.Text = "USD"; switch (hidExchangeType.Value) { case "1": lblMoney.Text = "VND"; // Where Fieldname is the name of fields from your database that you want to get break; default: break; } switch (hidPaymentType.Value) { case "1": lblHeader.Text = "Thu tiền thuê"; // Where Fieldname is the name of fields from your database that you want to get break; case "2": lblHeader.Text = "Thu tiền quản lý"; // Where Fieldname is the name of fields from your database that you want to get break; case "3": lblHeader.Text = "Thu tiền gửi xe"; // Where Fieldname is the name of fields from your database that you want to get break; case "4": lblHeader.Text = "Thu tiền giờ làm thêm"; // Where Fieldname is the name of fields from your database that you want to get break; case "5": lblHeader.Text = "Thu tiền Điện"; // Where Fieldname is the name of fields from your database that you want to get break; case "6": lblHeader.Text = "Thu tiền Nước"; // Where Fieldname is the name of fields from your database that you want to get break; case "7": lblHeader.Text = "Thu tiền Phí khác"; // Where Fieldname is the name of fields from your database that you want to get break; case "8": lblHeader.Text = "Thu tiền đặt phòng"; // Where Fieldname is the name of fields from your database that you want to get break; default: break; } } }
/// <summary> /// Load data /// </summary> private void LoadData() { CustomerData data = new CustomerData(); ITransaction tran = factory.GetLoadObject(data, hidCustomerId.Value); Execute(tran); if (!HasError) { //Get Data data = (CustomerData)tran.Result; lblCustomerId.Text = data.CustomerId; txtName.Text = data.Name; txtContactName.Text = data.ContactName; ShowData(); } }
protected void Page_Load(object sender, EventArgs e) { hidId.Value = Func.ParseString(Request["id"]); hidYearMonth.Value = Func.ParseString(Request["yearmonth"]); if (!IsPostBack) { txtCustomerId.Text = hidId.Value; hidBillId.Value = DbHelper.GetScalar("Select id from PaymentBillInfo where customerid = '" + hidId.Value + "' and YearMonth = '" + hidYearMonth.Value + "' and BuildingId= '" + Func.ParseString(Session["__BUILDINGID__"]) + "'"); if (Func.ParseInt(hidBillId.Value) > 0) { PaymentBillInfoData data = new PaymentBillInfoData(); ITransaction tran = factory.GetLoadObject(data, hidBillId.Value); Execute(tran); if (!HasError) { data = (PaymentBillInfoData)tran.Result; txtName.Text = data.Name; txtContactName.Text = data.ContactName; txtBank.Text = data.Bank; txtAccount.Text = data.Account; txtAccountName.Text = data.AccountName; txtOffice.Text = data.Office; txtOfficePhone.Text = data.OfficePhone; txtBillDate.Text = data.BillDate; txtUsdExchangeDate.Text = Func.FormatDMY(data.UsdExchangeDate); txtUsdExchange.Text = data.UsdExchange; } } if (String.IsNullOrEmpty(hidBillId.Value)) { CustomerData data = new CustomerData(); ITransaction tran = factory.GetLoadObject(data, hidId.Value); Execute(tran); if (!HasError) { //Get Data data = (CustomerData)tran.Result; txtCustomerId.Text = data.CustomerId; txtName.Text = data.Name; //txtComment.Text = data.Comment; txtContactName.Text = data.ContactName; } Mst_BuildingData dataB = new Mst_BuildingData(); ITransaction tranB = factory.GetLoadObject(dataB, Func.ParseString(Session["__BUILDINGID__"])); Execute(tranB); if (!HasError) { //Get Data dataB = (Mst_BuildingData)tranB.Result; txtBank.Text = dataB.Bank; txtAccount.Text = dataB.Account; txtAccountName.Text = dataB.AccountName; txtOffice.Text = dataB.Office; txtOfficePhone.Text = dataB.OfficePhone; } } } }
protected void Page_Load(object sender, EventArgs e) { hidID.Value = Func.ParseString(Request["id"]); if (!IsPostBack) { PopupWidth = 600; PopupHeight = 450; ShowData(); CustomerData data = new CustomerData(); ITransaction tran = factory.GetLoadObject(data, hidID.Value); Execute(tran); if (!HasError) { //Get Data data = (CustomerData)tran.Result; lblCustomerId.Text = data.CustomerId; lblName.Text = data.Name; lblComment.Text = data.Comment; } } }