protected void btnSaveFuneralService_Click(object sender, EventArgs e) { if (Page.IsValid) { try { FuneralServiceManageModel objModel; objModel = new FuneralServiceManageModel(); objModel.pkiServiceID = ServiceID; objModel.ServiceName = (txtServicename.Text).ToString(); objModel.ServiceDesc = (txtServiceDesc.Text).ToString(); if (txtServiceCost.Text == string.Empty || txtServiceCost.Text == "") { objModel.ServiceCost = 0; } else { objModel.ServiceCost = Convert.ToDecimal(txtServiceCost.Text); } if (txtQty.Text == string.Empty || txtQty.Text == "") { objModel.QTY = 0; } else { objModel.QTY = Convert.ToInt32(txtQty.Text); } SecureUserGroupsModel Access = client.GetSuperUserAccessByID(UserID, ParlourId).Where(x => x.fkiSecureGroupID == 12).FirstOrDefault();; if (Access != null) { Guid NewParlourID = (Guid)(ViewState["NewParlourID"]); objModel.parlourid = NewParlourID; } else { objModel.parlourid = ParlourId; } objModel.ModifiedUser = UserName; int a = client.SaveFuneralManageService(objModel); ShowMessage(ref lblMessage, MessageType.Success, "Service Successfully Saved."); ClearControl(); bindFuneralServiceList(); } catch (Exception ex) { ShowMessage(ref lblMessage, MessageType.Danger, ex.Message); } } }
//#region PageInit //protected void Page_Init(object sender, EventArgs e) //{ // SecureUserGroupsModel[] obj = client.EditSecurUserbyID(UserID); // List<int> list = new List<int>(); // list.Add(4); // list.Add(12); // var result = obj.Where(x => list.Contains(x.fkiSecureGroupID)); // if (result.FirstOrDefault() == null) // { // Response.Redirect("~/Admin/403Error.aspx", false); // } //} //#endregion #region PageLoad protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ddlPageSize.SelectedIndex = ddlPageSize.Items.IndexOf(ddlPageSize.Items.FindByValue(PageSize.ToString())); bindFuneralServiceList(); ddlCompanyList.Visible = false; SecureUserGroupsModel model = client.GetSuperUserAccessByID(UserID, ParlourId).Where(x => x.fkiSecureGroupID == 12).FirstOrDefault(); if (model != null) { bindCompanyType(); } btnAddService.Enabled = HasCreateRight; } }
public void BindFuneralServiceToUpdate() { btnReset.Enabled = true; SecureUserGroupsModel Access = client.GetSuperUserAccessByID(UserID, ParlourId).Where(x => x.fkiSecureGroupID == 12).FirstOrDefault(); FuneralServiceManageModel model = client.SelectFuneralManageServiceByParlANdID(ServiceID, ParlourId); if ((Access == null) && (model == null)) { Response.Write("<script>alert('Sorry!you are not authorized to perform edit on this Service.');</script>"); } else { ServiceID = model.pkiServiceID; txtServicename.Text = model.ServiceName; txtServiceCost.Text = (model.ServiceCost).ToString("N2"); txtServiceDesc.Text = model.ServiceDesc; txtQty.Text = (model.QTY).ToString(); btnAddService.Text = "Save"; } }
public static int SaveUserGroupDetails(SecureUserGroupsModel model) { return(ToolsSetingDAL.SaveUserGroupDetails(model)); }
protected void btnSubmite_Click(object sender, EventArgs e) { if (Page.IsValid) { SecureUsersModel model; model = _client.GetUserByID(txtUserNameUser.Text, Request.QueryString["CompanyParlourID"] != null ? CompanyParlourId : ParlourId); if (model != null && SecureUserId == 0) { ShowMessage(ref lblMessage, MessageType.Danger, "User Already Exists."); } else { model = new SecureUsersModel(); model.PkiUserID = SecureUserId; model.UserName = txtFullName.Text; model.Password = txtPasswordpass.Text; if (CompanyParlourId != new Guid("00000000-0000-0000-0000-000000000000")) { model.parlourid = CompanyParlourId; } else { model.parlourid = ParlourId; } model.EmployeeSurname = txtSurname.Text; model.EmployeeFullname = txtFullName.Text; model.EmployeeIDNumber = txtIDNumber.Text; model.EmployeeContactNumber = txtCellPhone.Text; model.EmployeeAddress1 = txtline1.Text; model.EmployeeAddress2 = txtline2.Text; model.EmployeeAddress3 = txtline3.Text; model.EmployeeAddress4 = txtline4.Text; model.LastModified = System.DateTime.Now; model.ModifiedUser = UserName; model.Email = txtUserNameUser.Text; model.Code = txtpostalcode.Text; model.CustomId1 = Convert.ToInt32(ddlCustom1.SelectedValue); model.CustomId2 = Convert.ToInt32(ddlCustom2.SelectedValue); model.CustomId3 = Convert.ToInt32(ddlCustom3.SelectedValue); if (ddlBankBranch.SelectedIndex != -1) { model.BranchId = new Guid(ddlBankBranch.SelectedValue); } else { model.BranchId = default(Guid); } //model.AgentName = txtAgentName.Text; // model.AgentSurname = txtAgentSurname.Text; //================================================================ int retID = _client.SaveUserDetails(model); SecureUserId = retID; // ==================[ User Security Group Insert Delete ]============================= int sguserID = 0; foreach (ListItem lst in chkSecurityGroup.Items) { if (lst.Selected) { SecureUserGroupsModel modelS = new SecureUserGroupsModel(); modelS.pkiSecureUserGroups = sguserID; modelS.fkiSecureUserID = SecureUserId; modelS.fkiSecureGroupID = Convert.ToInt32(lst.Value); modelS.sSecureUserGroupDesc = lst.Text; modelS.LastModified = System.DateTime.Now; modelS.ModifiedUser = UserName; if (sguserID == 0) { sguserID = _client.SaveUserGroupDetails(modelS); modelS.pkiSecureUserGroups = sguserID; } sguserID = _client.SaveUserGroupDetails(modelS); } } //bindEasyPayNumber(); ShowMessage(ref lblMessage, MessageType.Success, "User Details successfully saved"); BindUserList(); if (CompanyParlourId != new Guid("00000000-0000-0000-0000-000000000000")) { Response.Redirect("~/Tools/UserSetup.aspx"); } ClearControl(); } lblMessage.Visible = true; } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "goToTab512", "goToTab(5)", true); } }