private void SubmitRecord() { try { Model.CTINRequest request; if ((Boolean)ViewState["IsNewRecord"] == true) { request = new CTINRequest(); } else { request = (CTINRequest)Session[DataObjectName]; } request.CompanyTypeId = int.Parse(TinRequestForm.GetNestedControlValueByFieldName("CompanyTypeId").ToString()); request.CacNumber = (string)TinRequestForm.GetNestedControlValueByFieldName("CacNumber"); request.BNNumber = (string)TinRequestForm.GetNestedControlValueByFieldName("BNNumber"); request.RegistrationDate = (DateTime)TinRequestForm.GetNestedControlValueByFieldName("RegistrationDate"); request.CompanyName = (string)TinRequestForm.GetNestedControlValueByFieldName("CompanyName"); request.PreviousFCTTin = (string)TinRequestForm.GetNestedControlValueByFieldName("PreviousFCTTin"); request.BusinessLineId = (string)TinRequestForm.GetNestedControlValueByFieldName("BusinessLineId"); request.RegisteredAddressStreetNo = (string)TinRequestForm.GetNestedControlValueByFieldName("RegisteredAddressStreetNo"); request.RegisteredAddressStreet = (string)TinRequestForm.GetNestedControlValueByFieldName("RegisteredAddressStreet"); request.RegisteredAddressCity = (string)TinRequestForm.GetNestedControlValueByFieldName("RegisteredAddressCity"); request.RegisteredAddressCountryId = int.Parse(TinRequestForm.GetNestedControlValueByFieldName("RegisteredAddressCountryId").ToString()); request.RegisteredAddressStateId = (string)TinRequestForm.GetNestedControlValueByFieldName("RegisteredAddressStateId"); request.RegisteredAddressLgaId = int.Parse(TinRequestForm.GetNestedControlValueByFieldName("RegisteredAddressLgaId").ToString()); request.PrimaryPhone = (string)TinRequestForm.GetNestedControlValueByFieldName("PrimaryPhone"); request.SecondaryPhone = (string)TinRequestForm.GetNestedControlValueByFieldName("SecondaryPhone"); request.Email = (string)TinRequestForm.GetNestedControlValueByFieldName("Email"); request.ContactPerson = (string)TinRequestForm.GetNestedControlValueByFieldName("ContactPerson"); request.ContactPersonPhone = (string)TinRequestForm.GetNestedControlValueByFieldName("ContactPersonPhone"); request.TaxOfficeId = (string)TinRequestForm.GetNestedControlValueByFieldName("TaxOfficeId"); request.CreateDate = DateTime.Now; request.CreatedBy = Global.SessionUser.UserName; request.Status = "Submitted"; request.RecordSource = "FCTIRS"; ValidateRecord(request); if ((Boolean)ViewState["IsNewRecord"] == true) { context.CTINRequests.Add(request); context.SaveChanges(); } else { context.SaveChanges(); } DisplayAlert("Success", "Non-Individual TIN Request", "TIN Request Submitted Successfully"); TinRequestGrid.DataBind(); TinRequestMultiView.ActiveViewIndex = 0; } catch (Exception ex) { DisplayAlert("Danger", "Non-Individual TIN Request", ex.Message); } }
protected void RequestIdButton_Click(object sender, EventArgs e) { ViewState["IsNewRecord"] = false; ASPxButton btn = (ASPxButton)sender; GridViewDataItemTemplateContainer container = (GridViewDataItemTemplateContainer)btn.NamingContainer; var value = container.Grid.GetRowValues(container.VisibleIndex, new string[] { "RequestId" }); long requestId = (long)value; try { tinRequest = context.ITINRequests.Single(r => r.RequestId == requestId); context.Entry(tinRequest).Reload(); OriginLgaCombo_Callback(new object(), new CallbackEventArgsBase(tinRequest.OriginStateId)); AddressLgaCombo_Callback(new object(), new CallbackEventArgsBase(tinRequest.AddressStateId)); TinRequestForm.DataSource = tinRequest; TinRequestForm.DataBind(); Session["TinRequest"] = tinRequest; TinRequestMultiView.ActiveViewIndex = 1; SetButtonVisibility(); } catch (Exception ex) { DisplayAlert("Danger", "Get Individual Taxpayer", ex.Message); return; } }
private void SetButtonVisibility() { if ((Boolean)ViewState["IsNewRecord"] == true) { TinRequestForm.ForEach(ClearItem); TinRequestForm.ForEach(EnableItem); TinRequestForm.Enabled = true; SubmitButton.Visible = true; ApproveButton.Visible = false; RejectButton.Visible = false; } else { // check request status; tinRequest = (CTINRequest)Session[DataObjectName]; switch (tinRequest.Status) { case "Submitted": TinRequestForm.ForEach(DisableItem); SubmitButton.Visible = false; ApproveButton.Visible = Global.SessionUser.RoleId == 1 ? true : false; RejectButton.Visible = Global.SessionUser.RoleId == 1 ? true : false; break; case "Approved": TinRequestForm.ForEach(DisableItem); SubmitButton.Visible = false; ApproveButton.Visible = false; RejectButton.Visible = false; break; case "Rejected": TinRequestForm.Enabled = true; TinRequestForm.ForEach(EnableItem); if (Global.SessionUser.RoleId == 1) { TinRequestForm.ForEach(DisableItem); } SubmitButton.Visible = Global.SessionUser.RoleId == 1 ? false : true; ApproveButton.Visible = false; RejectButton.Visible = false; break; } } }
protected void ApproveButton_Click(object sender, EventArgs e) { try { string approvedBy = (string)Global.SessionUser.UserName; long requestId = (long)TinRequestForm.GetNestedControlValueByFieldName("RequestId"); string tin = Model.CTINRequest.ApproveTinRequest(requestId, approvedBy); string message = string.Format("TIN: {0} has been successfully generated.", tin); DisplayAlert("Success", "Non-Individual TIN Request", message); TinRequestGrid.DataBind(); TinRequestMultiView.ActiveViewIndex = 0; } catch (Exception ex) { DisplayAlert("Danger", "Individual TIN Request", ex.Message); } }
protected void RequestIdButton_Click(object sender, EventArgs e) { ViewState["IsNewRecord"] = false; ASPxButton btn = (ASPxButton)sender; GridViewDataItemTemplateContainer container = (GridViewDataItemTemplateContainer)btn.NamingContainer; var value = container.Grid.GetRowValues(container.VisibleIndex, new string[] { "RequestId" }); long requestId = (long)value; try { Session[DataObjectName] = context.CTINRequests.Where(r => r.RequestId == requestId).Single(); context.Entry((CTINRequest)Session[DataObjectName]).Reload(); Session[DataObjectName] = context.CTINRequests.Single(r => r.RequestId == requestId); TinRequestForm.DataSource = (CTINRequest)Session[DataObjectName]; TinRequestForm.DataBind(); TinRequestMultiView.ActiveViewIndex = 1; SetButtonVisibility(); if (CountryCombo.SelectedIndex > 0) { string country = (string)CountryCombo.SelectedItem.Value; AddressStateCombo_Callback(null, new CallbackEventArgsBase(country.ToString())); } string addressState = AddressStateCombo.SelectedIndex < 1 ? string.Empty : (string)AddressStateCombo.SelectedItem.Value; LgaCombo_Callback(null, new CallbackEventArgsBase(addressState)); } catch (Exception ex) { DisplayAlert("Danger", "Get Individual Taxpayer", ex.Message); return; } }
private void SubmitRecord() { try { Model.ITINRequest request = new Model.ITINRequest(); request = (Boolean)ViewState["IsNewRecord"] == true ? request : (ITINRequest)Session["TinRequest"]; request.LastName = (string)TinRequestForm.GetNestedControlValueByFieldName("LastName"); request.FirstName = (string)TinRequestForm.GetNestedControlValueByFieldName("FirstName"); request.MiddleName = (string)TinRequestForm.GetNestedControlValueByFieldName("MiddleName"); request.BVN = (string)TinRequestForm.GetNestedControlValueByFieldName("BVN"); request.JTBTIN = (string)TinRequestForm.GetNestedControlValueByFieldName("JTBTIN"); request.NIN = (string)TinRequestForm.GetNestedControlValueByFieldName("NIN"); request.Title = (string)TinRequestForm.GetNestedControlValueByFieldName("Title"); request.MaritalStatus = (string)TinRequestForm.GetNestedControlValueByFieldName("MaritalStatus"); request.Gender = (string)TinRequestForm.GetNestedControlValueByFieldName("Gender"); request.BirthDate = (DateTime)TinRequestForm.GetNestedControlValueByFieldName("BirthDate"); request.BirthCity = (string)TinRequestForm.GetNestedControlValueByFieldName("BirthCity"); request.BirthCountryId = int.Parse(TinRequestForm.GetNestedControlValueByFieldName("BirthCountryId").ToString()); request.BirthStateId = (string)TinRequestForm.GetNestedControlValueByFieldName("BirthStateId"); request.NationalityId = int.Parse(TinRequestForm.GetNestedControlValueByFieldName("NationalityId").ToString()); request.OriginStateId = (string)TinRequestForm.GetNestedControlValueByFieldName("OriginStateId"); if (!string.IsNullOrEmpty(OriginLgaCombo.Text)) { request.OriginLgaId = int.Parse(TinRequestForm.GetNestedControlValueByFieldName("OriginLgaId").ToString()); } request.Employer = (string)TinRequestForm.GetNestedControlValueByFieldName("Employer"); request.EmploymentId = (string)TinRequestForm.GetNestedControlValueByFieldName("EmploymentId"); request.Employer = (string)TinRequestForm.GetNestedControlValueByFieldName("Employer"); request.EmploymentStatus = (string)TinRequestForm.GetNestedControlValueByFieldName("EmploymentStatus"); request.Profession = (string)TinRequestForm.GetNestedControlValueByFieldName("Profession"); request.IdentificationNumber = (string)TinRequestForm.GetNestedControlValueByFieldName("IdentificationNumber"); request.IdentificationType = (string)TinRequestForm.GetNestedControlValueByFieldName("IdentificationType"); request.Phone1 = (string)TinRequestForm.GetNestedControlValueByFieldName("Phone1").ToString(); request.Phone2 = (string)TinRequestForm.GetNestedControlValueByFieldName("Phone2"); request.Email = (string)TinRequestForm.GetNestedControlValueByFieldName("Email"); request.Website = (string)TinRequestForm.GetNestedControlValueByFieldName("Website"); request.TaxOfficeId = (string)TinRequestForm.GetNestedControlValueByFieldName("TaxOfficeId"); request.StreetNo = (string)TinRequestForm.GetNestedControlValueByFieldName("StreetNo"); request.AddressLine1 = (string)TinRequestForm.GetNestedControlValueByFieldName("AddressLine1"); request.AddressLine2 = (string)TinRequestForm.GetNestedControlValueByFieldName("AddressLine2"); request.AddressCity = (string)TinRequestForm.GetNestedControlValueByFieldName("AddressCity"); request.AddressStateId = (string)TinRequestForm.GetNestedControlValueByFieldName("AddressStateId"); if (!string.IsNullOrEmpty(TinRequestForm.GetNestedControlValueByFieldName("AddressLgaId").ToString())) { request.AddressLgaId = int.Parse(TinRequestForm.GetNestedControlValueByFieldName("AddressLgaId").ToString()); } else { request.AddressLgaId = null; } request.RecordSource = "FCTIRS"; request.CreatedBy = Global.SessionUser.UserName; request.CreateDate = DateTime.Now; request.Status = "Submitted"; ValidateRecord(request); if ((Boolean)ViewState["IsNewRecord"] == true) { context.ITINRequests.Add(request); context.SaveChanges(); } else { context.SaveChanges(); } DisplayAlert("Success", "Individual TIN Request", "TIN Request Submitted Successfully"); TinRequestGridview.DataBind(); TinRequestMultiView.ActiveViewIndex = 0; } catch (Exception ex) { DisplayAlert("Danger", "Individual TIN Request", ex.Message); return; } }