public ActionResult EditBranchPartial(int Id) { Branchs branch = new Branchs(); branch = db.Branchs.Find(Id); return(PartialView("EditBranchPartial", branch)); }
protected void btnSave_Click(object sender, EventArgs e) { // Lấy giá trị Branchs _obj = new Branchs(); _obj.BranchID = this.txtBranchID.Text == "" ? 0 : Convert.ToInt32(this.txtBranchID.Text); _obj.FullName = this.txtFullName.Text; _obj.ImageUrl = this.txtImageURL.Text; _obj.Address = this.txtAddress.Text; _obj.Phone = this.txtPhone.Text; _obj.Fax = this.txtFax.Text; _obj.Email = this.txtEmail.Text; _obj.WebSite = this.txtWebSite.Text; _obj.Contents = this.ckEditor.Text; _obj.CreateDate = DateTime.Now; _obj.CreateUser = "******"; _obj.EditDate = DateTime.Now; _obj.EditUser = "******"; // Lưu xuống dữ liệu if (M_Mode.Mode == Modes.EDIT) { Branchs.Update(_obj); } else if (M_Mode.Mode == Modes.INSERT) { Branchs.Insert(_obj); } // Mở lại trang AboutUsManage Response.Redirect(@"~\App_WebAdmins\BranchManage.aspx"); }
protected void Page_Load(object sender, EventArgs e) { // Lấy giá trị tham số ID string ID = Request.QueryString["ID"].ToString(); // Gán giá trị cho Mode if (string.IsNullOrEmpty(ID)) { M_Mode.Mode = Modes.INSERT; } else { M_Mode.Mode = Modes.EDIT; } if (!IsPostBack) { // Khởi tạo control this.txtBranchID.Enabled = false; if (M_Mode.Mode == Modes.EDIT) { // Gán tiêu đề this.Page.Title = ""; this.lbModeMessage.Text = ""; // Gán ID this.txtBranchID.Text = ID; // Gán giá trị lên các control nhập liệu Branchs _obj = new Branchs(); _obj.BranchID = Convert.ToInt32(ID); _obj = Branchs.GetByID(_obj); this.txtBranchID.Text = _obj.BranchID.ToString(); this.txtFullName.Text = _obj.FullName; this.imgImageURL.ImageUrl = _obj.ImageUrl; this.txtImageURL.Text = _obj.ImageUrl; this.txtAddress.Text = _obj.Address; this.txtPhone.Text = _obj.Phone; this.txtMobile.Text = _obj.Mobile; this.txtFax.Text = _obj.Fax; this.txtEmail.Text = _obj.Email; this.txtWebSite.Text = _obj.WebSite; this.ckEditor.Text = _obj.Contents; } else if (M_Mode.Mode == Modes.INSERT) { // Gán tiêu đề this.Page.Title = "Thêm mới thông tin liên hệ"; this.lbModeMessage.Text = "Thêm mới thông tin liên hệ"; } } }
private void SetUpdatedBranchNames(string bname) { var Bankbranches = from br in BankBranchArr where br.BankName == bname select br.BranchName; Branchs.Clear(); foreach (var item in Bankbranches) { Branchs.Add(item); } }
public ActionResult EditBranchPartial(Branchs branch) { try { Branchs br = db.Branchs.Find(branch.Id); br.BranchName = branch.BranchName; db.SaveChanges(); return(RedirectToAction("Index")); } catch (Exception ex) { return(PartialView("EditBranchPartial", branch)); } }
public ActionResult Create(Branchs branch) { try { // TODO: Add insert logic here var branchSave = new Branchs { BranchId = branch.BranchId, BranchName = branch.BranchName }; db.Branchs.Add(branchSave); db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult DeleteBranch(int id) { try { Branchs br = db.Branchs.Find(id); var factors = db.Factors.Where(x => x.BranchId == br.BranchId); var criterias = db.Criterias.Where(x => x.BranchId == br.BranchId); var attributes = db.Attributes.Where(x => x.BranchId == br.BranchId); // đoạn này mở sau khi làm phần xác nhận đã //db.Attributes.RemoveRange(attributes); //db.Criterias.RemoveRange(criterias); //db.Factors.RemoveRange(factors); //db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
protected void gView_RowCommand(object sender, GridViewCommandEventArgs e) { string id = e.CommandArgument.ToString(); if (e.CommandName == "btnEdit") { // Sửa ClientScript.RegisterStartupScript(this.GetType(), "OpenWindow", "window.open('BranchEdit.aspx?ID=" + id + "');", true); } else if (e.CommandName == "btnDelete") { // Xóa Branchs _obj = new Branchs(); _obj.BranchID = Convert.ToInt32(id); Branchs.Delete(_obj); // Load lại dữ liệu gView_Binding(); } }
/// <summary> /// Gán dữ liệu cho ListView danh sách tin đã đăng /// </summary> /// <param name="NewsID"></param> private void ListView_DataBind() { ListView1.DataSource = Branchs.GetAll(); ListView1.DataBind(); }
/// <summary>The merchant authentication.</summary> /// <param name="ordersBrasPag">The orders bras pag.</param> /// <param name="branch">The branch.</param> /// <returns>The <see cref="MerchantAuthentication"/>.</returns> private MerchantAuthentication MerchantAuthentication(OrdersBrasPag ordersBrasPag, Branchs branch) { var authentication = new MerchantAuthentication(); if (ordersBrasPag.Value > 300) { authentication.MerchantId = new Guid(branch.MerchantIdCyber); authentication.MerchantKey = branch.MerchantKeyCyber; } else { authentication.MerchantId = new Guid(branch.MerchantId); authentication.MerchantKey = branch.MerchantKey; } return(authentication); }
/// <summary> /// Lấy dữ liệu lên GridView gvDescription /// </summary> private void gView_Binding() { gView.DataSource = Branchs.GetAll(); gView.DataBind(); }