protected void editbutton_Click(object sender, EventArgs e) { long Id = long.Parse(Idaccount.Text); CommonClassLibrary.Account ac = model.Accounts.Where(x => x.Id == Id).First(); ac.Name = editname.Text; ac.Idname = editno.Text; ac.Bank = editbank.Text; ac.Sector = editbran.Text; if (model.SaveChanges() >= 0) { this.SuccessPanel.Visible = true; this.SuccessLabel.Text = "บันทึกข้อมูลสำเร็จ"; this.ErrorPanel.Visible = false; showaccountdetail(); this.account.Visible = true; editform.Visible = false; } else { this.SuccessPanel.Visible = false; this.ErrorLabel.Text = "บันทึกข้อมูลไม่สำเร็จ"; this.ErrorPanel.Visible = true; //this.notification(false, "ไม่สามารถบันทึกข้อมูลได้"); } }
protected void Confirm_Button_Click(object sender, EventArgs e) { CommonClassLibrary.Account account = new CommonClassLibrary.Account() { Name = Name_account.Text, Idname = No_account.Text, Bank = Name_bank.Text, Sector = Sector_bank.Text }; model.Accounts.Add(account); if (model.SaveChanges() > 0) { this.SuccessPanel.Visible = true; this.SuccessLabel.Text = "บันทึกข้อมูลสำเร็จ"; this.ErrorPanel.Visible = false; showaccountdetail(); this.account.Visible = true; addaccount.Visible = false; } else { this.SuccessPanel.Visible = false; this.ErrorLabel.Text = "บันทึกข้อมูลไม่สำเร็จ"; this.ErrorPanel.Visible = true; } }
public void GetPaymentDetail() { PaymentPanel.Visible = true; long ID = long.Parse(Request.QueryString["Id"]); CommonClassLibrary.ConfirmPayment con = model.ConfirmPayments.Where(x => x.TicketOrder == ID).First(); string[] dateFull = con.Date.ToString().Split(' '); lb_DatePayment.Text = dateFull[0] + " " + con.Time.ToString(); lb_AmountPayment.Text = con.Price.ToString("#,##0.0") + " บาท"; if (con.Detiail.Equals("")) { lb_remark.Text = "-"; } else { lb_remark.Text = con.Detiail.ToString(); } CommonClassLibrary.Account ac = model.Accounts.Where(x => x.Id == con.Id_Account).First(); lb_AccountPayment.Text = ac.Bank + " เลขที่ : " + ac.Idname + " ชื่อบัญชี : " + ac.Name; if (con.UrlImage != "") { this.Image_category.ImageUrl = "/Image/" + con.UrlImage; } else { Image_category.ImageUrl = "" + "no_image_available.jpg"; } }
protected void buttonedit_Command(object sender, CommandEventArgs e) { account.Visible = false; addaccount.Visible = false; editform.Visible = true; long Id = long.Parse(e.CommandArgument.ToString()); CommonClassLibrary.Account ac = model.Accounts.Where(x => x.Id == Id).First(); Idaccount.Text = ac.Id.ToString(); editname.Text = ac.Name; editno.Text = ac.Idname; editbank.Text = ac.Bank; editbran.Text = ac.Sector; }
protected void Delete_LinkButton_Command(object sender, CommandEventArgs e) { long Id = long.Parse(e.CommandArgument.ToString()); CommonClassLibrary.Account ac = model.Accounts.Where(x => x.Id == Id).First(); model.Accounts.Remove(ac); if (model.SaveChanges() > 0) { this.SuccessPanel.Visible = true; this.SuccessLabel.Text = "บันทึกข้อมูลสำเร็จ"; this.ErrorPanel.Visible = false; showaccountdetail(); this.account.Visible = true; editform.Visible = false; addaccount.Visible = false; } else { this.SuccessPanel.Visible = false; this.ErrorLabel.Text = "บันทึกข้อมูลไม่สำเร็จ"; this.ErrorPanel.Visible = true; } }