protected void btnSave_Click(object sender, EventArgs e) { if (txtNewPwd.Text == "") { txtNewPwd.Focus(); return; } if (txtConfirmPwd.Text == txtNewPwd.Text) { BL_Users obj = new BL_Users(); obj.USER_NAME = ""; obj.ID = Convert.ToInt32(Session["UserId"]); obj.REGISTERED_DATE = System.DateTime.Now; obj.PWD = EncryptDecrypt.base64Encode(txtConfirmPwd.Text); obj.EVENT = 'C'; int Id = 0; string msg = ""; msg = obj.InsUpdDeleteUsers(out Id); if (msg == "Password Changed Successfully") { msgbox.ShowSuccess(msg); txtNewPwd.Text = ""; txtConfirmPwd.Text = ""; txtCurrentPwd.Text = ""; } else { msgbox.ShowWarning(msg); } } }
private void InsUpdDelUserRoles(char EVENT, int ID) { BL_UserRoles obj = new BL_UserRoles(); obj.EVENT = EVENT; obj.ID = ID; obj.ROLE_ID = Convert.ToInt32((string)ddlRoles.SelectedValue); obj.USER_ID = Convert.ToInt32((string)ddlUsers.SelectedValue); string msg = ""; msg = obj.InsUpdDelUserRoles(out ID); if (msg == "Record Inserted Successfully" || msg == "Record Updated Successfully" || msg == "Record Deleted Successfully") { msgbox.ShowSuccess(msg); ddlUsers.SelectedValue = "0"; ddlRoles.SelectedValue = "0"; btnSave.CommandName = "Save"; btnSave.Text = "Save"; FillgvUserRoles(); } else { msgbox.ShowWarning(msg); } }
protected void btnSubmit_Click(object sender, EventArgs e) { var conn = new SqlConnection(ConfigurationManager.ConnectionStrings["CSCommonDB"].ToString()); conn.Open(); var cmd = new SqlCommand("Insert into tbl_WorkingArea(Zone,District, MPC, VDC) values('" + ddlPermanentZone.SelectedItem.Text + "','" + txtDistrict.Text + "','" + txtMPC.Text + "','" + txtVDC.Text + "')", conn); try { using (conn) cmd.ExecuteNonQuery(); msgbox.ShowSuccess("Successfully Inserted"); gvWArea.DataBind(); txtDistrict.Text = ""; } catch (Exception) { msgbox.ShowSuccess("Enter Correct Information"); } }
private void InsUpdDelLa(char Event, int Id) { try { BlLa objbl = new BlLa(); PL_LA obj = new PL_LA(); obj.LA_ID = Id; obj.EVENT = Event; if (Event == 'D') { } else { obj.LA_Code = txtParticularcode.Text; obj.LA = txtParticular.Text; obj.LA_ParentID = int.Parse(tv.SelectedNode.Value); obj.LA_Primary = chkPrimary.Checked; //obj.LA_Child = ddlUnder.SelectedValue; obj.IsNeeded = chkIsNeeded.Checked; //obj.p_headerid = int.Parse(ddlPearls.SelectedValue); } string msg = objbl.InsUpdDelLa(obj, out Id); if (msg == "Record Inserted Successfully" || msg == "Record Updated Successfully" || msg == "Record Deleted Successfully") { msgbox.ShowSuccess(msg); BuildTree(Convert.ToInt32(hfValue.Value)); Clear(); } else { msgbox.ShowWarning(msg); } } catch (Exception ex) { msgbox.ShowWarning(ex.Message); } }
private void InsUpdDelRoles(char Event, int Id) { BL_Roles obj = new BL_Roles(); obj.EVENT = Event; obj.ROLE_ID = Id; obj.ROLE_NAME = txtRoleName.Text; string msg = ""; msg = obj.InsUpdDelRoles(out Id); if (msg != "Record Inserted Successfully" || msg != "Record Updated Successfully" || msg != "Record Deleted Successfully") { msgbox.ShowSuccess(msg); FillgvRoles(); filldropdown(); txtRoleName.Text = ""; btnRole.CommandName = "Save"; } else { msgbox.ShowWarning(msg); } }
private void InsUpdDelBankDetail(char Event, int id) { var msg = ""; if (Event == 'I' || Event == 'U') { msgSuccess.Text = ""; msgSuccess.Visible = false; int userid = Convert.ToInt16(BK_Session.GetSession().UserId.ToString()); var accounttype = ""; var cashbank = false; var bankid = 0; var maturitydate = new DateTime(); if (ddlaccounttype.SelectedValue == "1") { accounttype = "C"; txtRate.Text = "0"; txtAmount.Text = "0"; maturitydate = DateTime.Parse("01/01/1991"); } else if (ddlaccounttype.SelectedValue == "2") { accounttype = "S"; txtAmount.Text = "0"; maturitydate = DateTime.Parse("01/01/1991"); } else { txtAmount.Text = "0"; accounttype = "FD"; maturitydate = DateTime.Parse(txtMaturityDate.Text); } if (ddlmodeofpayment.SelectedItem.Text == "Bank") { cashbank = true; bankid = int.Parse(ddlSelectBank.SelectedValue); } var objBank = new Bank(id, txt_BankName.Text + "-" + txt_AccountNo.Text, txt_AccountNo.Text, float.Parse(txtAmount.Text), 0, Convert.ToDateTime(txt_OpeningDate.Text), BK_Session.GetSession().UserId, Convert.ToDateTime(txt_OpeningDate.Text), 0, Convert.ToDateTime(txt_OpeningDate.Text), accounttype, ddl_class.SelectedValue, int.Parse(ddlBranch.SelectedValue), decimal.Parse(txtRate.Text), int.Parse(ddl_calMethod.SelectedValue), int.Parse(ddl_acc.SelectedValue), maturitydate, cashbank, bankid, txtinterestaccumulation.Text); msg = BL_Bank_Desc.InsUpdDelBankDetail(Event, objBank, out id); branchId = BK_Session.GetSession().BranchId; FillGrid(); } else { } if (DatabaseMessage.ContainMessage(msg)) { msgbox.ShowSuccess(msg); } else { msgbox.ShowWarning(msg); } }
private void InsupdDeleteMenu(char Event, int Id) { var obj = new BL_MainMenu(); Session["UserId"] = 0; if (txtOrder.Text != "") { obj.Odr = Convert.ToInt32((string)txtOrder.Text); } if (Event == 'D') { obj.EVENT = Event; obj.MainMenuID = Id; var msg = ""; msg = obj.InsUpdDeleteMainMenu(out Id); if (msg == "Record Deleted Successfully") { msgbox.ShowSuccess(msg); } else { msgbox.ShowWarning(msg); } } else if (CheckValidFile()) { if (Event == 'I') { obj.EVENT = Event; obj.MainMenuID = 0; obj.MenuName = txtMenuName.Text; obj.ImageURL = fuImage.PostedFile.FileName; if ((fuImage.PostedFile != null) && (fuImage.PostedFile.ContentLength > 0)) { var fn = System.IO.Path.GetFileName(fuImage.PostedFile.FileName); var SaveLocation = Server.MapPath("~/Images") + "\\" + fn; obj.ImageURL = "~/Images/" + fn; try { fuImage.PostedFile.SaveAs(SaveLocation); } catch (Exception ex) { msgbox.ShowWarning("Error: " + ex.Message); //Note: Exception.Message returns a detailed message that describes the current exception. //For security reasons, we do not recommend that you return Exception.Message to end users in //production environments. It would be better to put a generic error message. } } Id = 0; var msg = ""; msg = obj.InsUpdDeleteMainMenu(out Id); if (msg == "Record Inserted Successfully") { msgbox.ShowSuccess(msg); } else { msgbox.ShowWarning(msg); } } else if (Event == 'U') { obj.EVENT = Event; obj.MainMenuID = Id; obj.MenuName = txtMenuName.Text; if ((fuImage.PostedFile != null) && (fuImage.PostedFile.ContentLength > 0)) { var fn = System.IO.Path.GetFileName(fuImage.PostedFile.FileName); var SaveLocation = Server.MapPath("~/Images") + "\\" + fn; obj.ImageURL = "~/Images/" + fn; try { fuImage.PostedFile.SaveAs(SaveLocation); Response.Write("The file has been uploaded."); } catch (Exception ex) { Response.Write("Error: " + ex.Message); //Note: Exception.Message returns a detailed message that describes the current exception. //For security reasons, we do not recommend that you return Exception.Message to end users in //production environments. It would be better to put a generic error message. } } var msg = ""; msg = obj.InsUpdDeleteMainMenu(out Id); if (msg == "Record Updated Successfully") { msgbox.ShowSuccess(msg); } else { msgbox.ShowWarning(msg); } } } btnMenu.Text = "Save"; btnMenu.CommandName = "Save"; txtMenuName.Text = ""; FillgvMenu(); }
private void InsUpdDelCompanyInfo(char Event, string Id) { try { BL_CompanyInfoDrose obj = new BL_CompanyInfoDrose(); string CompanyName = txtCompanyName.Text; string CompanyName1 = CompanyName.Substring(0, 10); int cc = CompanyName.Length - 10; string CompanyName2 = CompanyName.Substring(10, cc); obj.EVENT = Event; obj.Co_ID = 0; if (Event == 'I' || Event == 'U') { obj.CompanyName = txtCompanyName.Text; obj.RegistrationNo = txtRegistrationNo.Text; obj.PanNo = (txtPanNo.Text); obj.Country = (txtCountry.Text); obj.State = (txtState.Text); obj.City = (txtCity.Text); obj.Adress1 = (txtAddress1.Text); obj.Adress2 = (txtAddress2.Text); obj.TelephoneNo = (txtTelephoneNo.Text); obj.EmailAdress = (txtEmailAddress.Text); obj.WebAdress = (txtWebAddress.Text); obj.C1 = (CompanyName1); obj.C2 = (CompanyName2); obj.MC = ""; obj.Created_Date = (ConvertNE.convertNepaliToEnglish(txtDate.Text).ToString()); obj.COMPANY_CODE = Id; obj.ADMIN_USER_NAME = (txtUserName.Text); obj.PWD = (txtPassword.Text); obj.IMAGES_DRIVE = txtImagesDrive.Text; obj.CONTACT_PERSON_NAME = txtContactAddress.Text; obj.EMAIL_ADDRESS = txtEmailAdd.Text; obj.MIRROR_AC_DROSE = txtMirrorDrose.Text; obj.MIRROR_AC_NCB = txtMirrorNCB.Text; obj.NOSTRO_AC_NCB = txtNostroAcNCB.Text; obj.MOB_NO = txtMobNo.Text; obj.C_ADDRESS = txtContactAddress.Text; obj.C_TEL_NO = txtTelNo.Text; } string msg = obj.InsUpdDelCompanyInfo(out Id); if (msg == "Record Inserted Successfully" || msg == "Record Updated Successfully" || msg == "Record Deleted Successfully") { string path = txtImagesDrive.Text + Id.ToString(); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } string p = picUpload(FileUpload1, path); if (p == "url") { p = "nophoto.gif"; } //Check Info In Company Code // BL_CompanyInfoDrose. msgbox.ShowSuccess(msg); Response.Redirect("~/Common/OrganizationList.aspx"); ExecuteQuery(Id); Clear(); } else { msgbox.ShowWarning(msg); } } catch (Exception ex) { msgbox.ShowWarning(ex.Message); } }
private void InsupdDeleteusers(char Event, int Id) { var obj = new BL_Users(); if (Event == 'I') { if (txtPassword.Text == txtConfirmPassword.Text) { obj.EVENT = 'I'; // obj.NAME = txtFirstName.Text + " " + txtLastName.Text; obj.STAFF_ID = Convert.ToInt32((string)ddlStaffName.SelectedValue); obj.PWD = EncryptDecrypt.base64Encode(txtPassword.Text); obj.CONTACT_NO = txtContactNo.Text; obj.ADDRESS = txtAddress.Text; obj.EMAIL_ID = txtEmail.Text; obj.REGISTERED_BY = Convert.ToInt32(BK_Session.GetSession().UserId); obj.REGISTERED_DATE = System.DateTime.Now; obj.USER_NAME = txtUserName.Text + lblCompanyCode.Text; obj.USER_STATUS = true; obj.ROLE_ID = Convert.ToInt32((string)ddlRoles.SelectedValue); obj.BranchId = Convert.ToInt32(BK_Session.GetSession().BranchId); Id = 0; var msg = ""; msg = obj.InsUpdDeleteUsers(out Id); if (msg == "Record Inserted Successfully") { msgbox.ShowSuccess(msg); Clear(); } else { msgbox.ShowWarning(msg); } } } else if (Event == 'U') { obj.EVENT = Event; obj.ID = Id; obj.STAFF_ID = Convert.ToInt32((string)ddlStaffName.SelectedValue); obj.PWD = EncryptDecrypt.base64Encode(txtPassword.Text + lblCompanyCode.Text); obj.CONTACT_NO = txtContactNo.Text; obj.ADDRESS = txtAddress.Text; obj.EMAIL_ID = txtEmail.Text; obj.REGISTERED_BY = Convert.ToInt32(BK_Session.GetSession().UserId); obj.REGISTERED_DATE = BK_Session.GetSession().OpDate; obj.USER_NAME = txtUserName.Text; obj.USER_STATUS = true; obj.ROLE_ID = Convert.ToInt32((string)ddlRoles.SelectedValue); obj.BranchId = Convert.ToInt32(BK_Session.GetSession().BranchId); Id = 0; var msg = ""; msg = obj.InsUpdDeleteUsers(out Id); if (msg == "Record Updated Successfully") { msgbox.ShowSuccess(msg); Clear(); } else { msgbox.ShowWarning(msg); } } else if (Event == 'D') { obj.EVENT = Event; obj.ID = Id; obj.STAFF_ID = Convert.ToInt32((string)ddlStaffName.SelectedValue); obj.PWD = EncryptDecrypt.base64Encode(txtPassword.Text); obj.ADDRESS = txtAddress.Text; obj.CONTACT_NO = txtContactNo.Text; obj.EMAIL_ID = txtEmail.Text; obj.REGISTERED_BY = Convert.ToInt32(BK_Session.GetSession().UserId); obj.REGISTERED_DATE = BK_Session.GetSession().OpDate; obj.USER_NAME = txtUserName.Text; Id = 0; var msg = ""; msg = obj.InsUpdDeleteUsers(out Id); if (msg == "Record Deleted Successfully") { msgbox.ShowSuccess(msg); Clear(); } else { msgbox.ShowWarning(msg); } } else { obj.EVENT = Event; obj.ID = Id; obj.STAFF_ID = Convert.ToInt32((string)ddlStaffName.SelectedValue); var pwd = (txtPassword.Text).ToLower(); obj.PWD = EncryptDecrypt.base64Encode(pwd); obj.ADDRESS = txtAddress.Text; obj.CONTACT_NO = txtContactNo.Text; obj.EMAIL_ID = txtEmail.Text; obj.REGISTERED_BY = Convert.ToInt32(BK_Session.GetSession().UserId); obj.REGISTERED_DATE = BK_Session.GetSession().OpDate; obj.USER_NAME = txtUserName.Text; Id = 0; var msg = ""; msg = obj.InsUpdDeleteUsers(out Id); if (msg == "Password Changed Successfully") { msgbox.ShowSuccess(msg); Clear(); } else { msgbox.ShowWarning(msg); } } FillgvUsers(); }