protected void btnSave_Click(object sender, EventArgs e) { BranchClass.GetBranchName = txtDepartmentName.Text.Trim(); BranchClass.InsertBracnh(); FillDeprtment(); ClearAll(); }
public bool Save(BranchClass branch) { bool bResult = false; branch.BranchCode = GenerateBranchCode(); using (DbManager db = new DbManager()) { try { if (branch.RecordNo != 0) { Accessor.Query.Update(db, branch); } else { Accessor.Query.Insert(db, branch); } bResult = true; } catch (Exception except) { throw new System.ArgumentException(except.Message); } } return(bResult); }
protected void Delete_Click(object sender, ImageClickEventArgs e) { ImageButton delete = (ImageButton)sender; BranchClass.DID = Convert.ToInt32(delete.CommandArgument); BranchClass.DeleteBracnh(); FillDeprtment(); ClearAll(); }
public async Task <ActionResult <BranchClass> > CreateNewBranchClass(BranchClass branchClass) { if (ModelState.IsValid) { var branchCl = await _branchClassRepository.CreateBranchClass(branchClass); return(Ok(branchCl)); } return(BadRequest("Model is not valid")); }
protected void btnUpdate_Click(object sender, EventArgs e) { BranchClass.GetBranchName = txtDepartmentName.Text.Trim(); BranchClass.DID = Convert.ToInt32(Session["Edit"]); BranchClass.UpdateBracnh(); FillDeprtment(); ClearAll(); btnSave.Visible = true; btnUpdate.Visible = false; }
private List <CustomerInventoryGroup> AddSelectedCustomers() { List <CustomerInventoryGroup> selectedCustomers = CUSTOMERS; foreach (GridViewRow row_customer in gvCustomers.Rows) { CheckBox ck = ((CheckBox)row_customer.FindControl("chkItems")); Image imgCustomer = (Image)row_customer.FindControl("imgCustomer"); if (ck.Checked) { CustomerReferenceLink CRL = CustInvGroupManager.GetCustomerLinkByCustCode(imgCustomer.ToolTip); BranchClass branch = BranchManager.GetBranchByCode(CRL.BranchCode); AccountClass account = AccountManager.GetAccountByCode(branch.AccountCode); string BrandName; if (string.IsNullOrEmpty(HttpUtility.HtmlDecode(row_customer.Cells[3].Text)) || string.IsNullOrWhiteSpace(HttpUtility.HtmlDecode(row_customer.Cells[3].Text))) { BrandName = brandManager.GetBrandByCode(CRL.BrandCode).BrandDescription; } else { BrandName = row_customer.Cells[3].Text; } CustomerInventoryGroup customer = new CustomerInventoryGroup { CustomerNumber = int.Parse(imgCustomer.AlternateText), CustomerName = row_customer.Cells[2].Text, BrandName = BrandName, AccountName = account.AccountName, BranchName = branch.BranchName }; if (!IsAlreadySelected(CUSTOMERS, customer.CustomerNumber)) { if (string.IsNullOrEmpty(customer.AccountName) || string.IsNullOrWhiteSpace(customer.AccountName)) { hfWarningHandler_ModalPopupExtender.Show(); } else { selectedCustomers.Add(customer); } } } } return(selectedCustomers); }
public bool Delete(BranchClass branch) { bool bResult = false; try { using (DbManager db = new DbManager()) { Accessor.Query.Delete(db, branch); bResult = true; } } catch (Exception except) { throw new System.ArgumentException(except.Message); } return(bResult); }
public bool ValidateData(BranchClass branch, ref string Message) { bool bResult = false; if (string.IsNullOrEmpty(branch.AccountCode) == true) { Message = "Account name required!"; return(bResult); } if (string.IsNullOrEmpty(branch.BranchName) == true) { Message = "Branch name required!"; return(bResult); } int iResultCount = 0; bool bChange = true; if (OldBranch.AccountCode == branch.AccountCode || TransState == TransactionState.Add) { iResultCount = Accessor.BranchByBranchName(branch.AccountCode, branch.BranchName).Count; if (TransState == TransactionState.Update) { if (OldBranch.BranchName == branch.BranchName) { bChange = false; } } } if (iResultCount > 0 && bChange == true) { Message = "Branch name already been used!"; return(bResult); } /* * string[] paramKey = new string[2]; * string[] paramColumn = new string[2]; * * paramKey[0] = branch.BranchName; * paramKey[1] = branch.BranchCode; * paramColumn[0] = "BRANCH_NAME"; * paramColumn[1] = "BRANCH_CODE"; * int iResultCount = 0; * bool bChange = true; * * iResultCount = Accessor.Query.SelectByKeyWords<BranchClass>(paramKey,paramColumn).Count; * * if (TransState == TransactionState.Update) * { * if (OldBranch.BranchName == branch.BranchName) * bChange = false; * } * * if (iResultCount > 0 && bChange == true) * { * Message = "Branch name already been used!"; * return bResult; * } * * * * paramKey = new string[1]; * paramColumn = new string[1]; * paramKey[0] = branch.BranchCode; * paramColumn[0] = "BRANCH_CODE"; * iResultCount = 0; * bChange = true; * * iResultCount = Accessor.Query.SelectByKeyWords<BranchClass>(paramKey, paramColumn).Count; * * if (TransState == TransactionState.Update) * { * if (OldBranch.BranchCode == branch.BranchCode) * bChange = false; * } * * if (iResultCount > 0 && bChange == true) * { * Message = "Branch code already been used!"; * return bResult; * }*/ bResult = true; return(bResult); }