private void InsUpdDelStaffInfo(char Event, int id) { var msg = ""; if (Event == 'I' || Event == 'U') { // var session=new BK_Session(int userId,) var objStaff = new Staff(id, Convert.ToInt32(BK_Session.GetSession().UserId), Convert.ToInt32((string)ddl_branch.SelectedValue), txtStaffName.Text, Convert.ToInt32((string)ddlDesignation.SelectedValue), txtAddress.Text, txtContactNo.Text, txtEmail.Text, Convert.ToInt32((string)ddlQualification.SelectedValue), txtRemarks.Text, true, Convert.ToDateTime(BK_Session.GetSession().OpDate), Convert.ToInt32((string)ddlGender.SelectedValue), Convert.ToDateTime(txtJobStartDate.Text), Convert.ToInt32((string)ddlTitle.SelectedValue), Convert.ToDateTime("01/01/1991"), Convert.ToDateTime("01/01/1991"), Convert.ToDateTime(txtDOB.Text), txtCitizenNo.Text, txtPpNo.Text, Convert.ToInt32((string)ddlDepartment.SelectedValue), Convert.ToInt32((string)ddlmaritalstatus.SelectedValue), Convert.ToInt32((string)ddlServiceType.SelectedValue), Convert.ToInt32((string)ddlEthnicGroups.SelectedValue)); msg = BL_Staff.InsUpdDelStaffInfo(Event, objStaff, out id); } else if (Event == 'N') { var objStaff = new Staff(id, 0, 0, "", 0, "", "", "", 0, "", false, Convert.ToDateTime("01/01/1991"), 0, Convert.ToDateTime("01/01/1991"), 0, Convert.ToDateTime("01/01/1991"), Convert.ToDateTime("01/01/1991"), Convert.ToDateTime("01/01/1991"), "", "", 0, 0, 0, 0); msg = BL_Staff.UpdStaffToInactive(Event, objStaff, out id); } else { var objStaff = new Staff(id, 0, 0, "", 0, "", "", "", 0, "", false, Convert.ToDateTime("01/01/1991"), 0, Convert.ToDateTime("01/01/1991"), 0, Convert.ToDateTime("01/01/1991"), Convert.ToDateTime("01/01/1991"), Convert.ToDateTime("01/01/1991"), "", "", 0, 0, 0, 0); msg = BL_Staff.InsUpdDelStaffInfo(Event, objStaff, out id); } if (DatabaseMessage.ContainMessage(msg)) { _msgbox.ShowSuccess(msg); } else { _msgbox.ShowWarning(msg); } FillGridview(); ClearAll(); }
//Save Event #region [Save Event] protected void btnSave_Click(object sender, EventArgs e) { try { BL_Staff objBL = new BL_Staff(); EWA_Staff objEWA = new EWA_Staff(); Action("Save"); } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
public static DropDownList FillddlEthnicGroup(DropDownList ddl, int EVENT, int ID, string CODE) { ddl.Items.Clear(); var dt = BL_Staff.GetEthnicGroup(EVENT, ID, CODE); if (dt.Rows.Count > 0) { ddl.DataSource = dt; ddl.DataValueField = "Cat_Id"; ddl.DataTextField = "CategoryName"; ddl.DataBind(); ddl.Items.Insert(0, new ListItem("Select", "0", true)); } return(ddl); }
internal static DropDownList FillddlStaffName(DropDownList ddlStaffName, int EVENT, int ID, string CODE) { ddlStaffName.Items.Clear(); var dt = BL_Staff.GetStaffDetail(EVENT, ID, CODE, ""); if (dt.Rows.Count > 0) { ddlStaffName.DataSource = dt; ddlStaffName.DataValueField = "staffId"; ddlStaffName.DataTextField = "Name"; ddlStaffName.DataBind(); ddlStaffName.Items.Insert(0, new ListItem("Select", "0", true)); } return(ddlStaffName); }
internal static DropDownList FillDdlAcedamicQualification(DropDownList ddlQualification, int Event, int ID, string CODE) { ddlQualification.Items.Clear(); var dt = BL_Staff.GetAcedamicQualification(Event, ID, CODE); if (dt.Rows.Count > 0) { ddlQualification.DataSource = dt; ddlQualification.DataValueField = "Id"; ddlQualification.DataTextField = "Qualification"; ddlQualification.DataBind(); ddlQualification.Items.Insert(0, new ListItem("Select", "0", true)); } return(ddlQualification); }
internal static DropDownList FillddlDepartment(DropDownList ddlDepartment, int Event, int ID, string CODE) { ddlDepartment.Items.Clear(); var dt = BL_Staff.GetDepartment(Event, ID, CODE); if (dt.Rows.Count > 0) { ddlDepartment.DataSource = dt; ddlDepartment.DataValueField = "DeptId"; ddlDepartment.DataTextField = "DeptName"; ddlDepartment.DataBind(); ddlDepartment.Items.Insert(0, new ListItem("Select", "0", true)); } return(ddlDepartment); }
internal static DropDownList FillddlServiceType(DropDownList ddl, int Event, int ID, string CODE) { ddl.Items.Clear(); var dt = BL_Staff.GetService(Event, ID, CODE); if (dt.Rows.Count > 0) { ddl.DataSource = dt; ddl.DataValueField = "Id"; ddl.DataTextField = "ServiceName"; ddl.DataBind(); ddl.Items.Insert(0, new ListItem("Select", "0", true)); } return(ddl); }
//Bind Staff Id #region [Bind Staff Id] private void BindStaffId() { try { EWA_Staff objEWA = new EWA_Staff(); BL_Staff objBL = new BL_Staff(); //Send it from Session objEWA.OrgId = 1; DataSet StaffIdds = objBL.GetStaffCode_BL(objEWA); string StaffId = StaffIdds.Tables[0].Rows[0][0].ToString(); lblEmpCode.Text = objEWA.OrgId + StaffId; ViewState["EmpCode"] = lblEmpCode.Text; txtUserName.Text = ViewState["EmpCode"].ToString(); } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
//protected void btnPre2_Click(object sender, EventArgs e) //{ // try // { // Panel_ContactGeneralInfo.Visible = true; // Panel_QualificationBankingDetails.Visible = false; // } // catch (Exception exp) // { // GeneralErr(exp.Message.ToString()); // } //} protected void btnSave_Click(object sender, EventArgs e) { try { BL_Staff objBL = new BL_Staff(); EWA_Staff objEWA = new EWA_Staff(); //if (txtPassword.Text == txtConfirmPassword.Text) //{ Action("Save"); //Response.Redirect("~/Forms/Admin/Admin_Home.aspx?", false); //} //else //{ // msgBox.ShowMessage("Password and confirm password not match !!!", "Saved", UserControls.MessageBox.MessageStyle.Critical); //} } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
private void InsUpdDelSetup(string value, char Event, int id) { var msg = ""; if ((value == "Dg") && (Event == 'I' || Event == 'U')) { var objDesignation = new Designation(id, txtDesignation.Text); msg = BL_Staff.InsUpdDelDesignation(Event, objDesignation, out id); } else if ((value == "Dp") && (Event == 'I' || Event == 'U')) { var objDepartment = new Department(id, txtDepartment.Text); msg = BL_Staff.InsUpdDelDepartment(Event, objDepartment, out id); } else if ((value == "Aq") && (Event == 'I' || Event == 'U')) { var objQualification = new AcedamicQualification(id, txtAcedamicQualification.Text); msg = BL_Staff.InsUpdDelAcedamicQualification(Event, objQualification, out id); } else if ((value == "St") && (Event == 'I' || Event == 'U')) { var objServiceType = new ServiceType(id, txtServiceType.Text); msg = BL_Staff.InsUpdDelService(Event, objServiceType, out id); } else if ((value == "Eg") && (Event == 'I' || Event == 'U')) { var objEthnicGroup = new EthnicGroup(id, txtEthnicGroup.Text, 1, "XX"); msg = BL_Staff.InsUpdDelEthnicGroup(Event, objEthnicGroup, out id); } if (DatabaseMessage.ContainMessage(msg)) { _msgbox.ShowSuccess(msg); } else { _msgbox.ShowWarning(msg); } // FillGridview(); // ClearAll(); }
//Save Click #region [Save Event] protected void btnSave_Click1(object sender, EventArgs e) { BL_Staff objBL = new BL_Staff(); EWA_Staff objEWA = new EWA_Staff(); try { if (txtEmail.Text == "") { msgBox.ShowMessage("Please enter staff email !!!", "Information", UserControls.MessageBox.MessageStyle.Information); } else { Action("Save"); } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); //throw; } }
//Bind Staff Id #region [Bind Staff Id] private void BindStaffId() { try { EWA_Staff objEWA = new EWA_Staff(); BL_Staff objBL = new BL_Staff(); //Send it from Session objEWA.OrgId = orgId; float ID = DB.getDb_Value("select max(EmpId) from tblEmployee where OrgId='" + objEWA.OrgId + "'"); ID++; string newid = "00" + ID.ToString(); //DataSet StaffIdds = objBL.GetStaffCode_BL(objEWA); //string StaffId = StaffIdds.Tables[0].Rows[0][0].ToString(); lblEmpCode.Text = objEWA.OrgId + newid.ToString(); ViewState["EmpCode"] = lblEmpCode.Text; txtUserName.Text = ViewState["EmpCode"].ToString(); } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
//Perform Action for Employee #region [Perform Action] private void Action(string strAction) { EWA_Staff objEWA = new EWA_Staff(); BL_Staff objBL = new BL_Staff(); try { objEWA.Action = strAction; //if (strAction == "Update" || strAction == "Delete") //{ // objEWA.StaffId = Convert.ToInt32(ViewState["DocumentId"].ToString()); //} //objEWA.EmpCode = lblEmpCode.Text; objEWA.EmpCode = ViewState["EmpCode"].ToString(); objEWA.DesignationTypeId = rbtnDesignationType.SelectedValue; objEWA.FirstName = txtFirstName.Text.Trim(); objEWA.MiddleName = txtMiddleName.Text.Trim(); objEWA.LastName = txtLastName.Text.Trim(); objEWA.MotherName = txtMotherName.Text.Trim(); objEWA.Gender = rbtnGender.SelectedValue; objEWA.DOB = (txt_BirthDate.Text); objEWA.BloodGroup = ddlBloodGroup.SelectedValue; objEWA.MaritalStatus = rbtnMaritalStatus.SelectedValue; objEWA.Handicap = ddl_Handicap.SelectedValue; objEWA.HandicapPercentage = Convert.ToInt32(txtHandicapPercentage.Text.Trim()); objEWA.PresentAddress = txtPresentAddress.Text.Trim(); objEWA.PresentCountry = ddlPresentCountry.SelectedItem.ToString(); objEWA.PresentState = ddlPresentState.SelectedItem.ToString(); objEWA.PresentCity = ddlPresentCity.SelectedItem.ToString(); objEWA.PresentPinCode = Convert.ToInt32(txtPresentPinCode.Text); objEWA.PermanentAddress = txtPermanentAddress.Text.Trim(); objEWA.PermanentCountry = ddlPermanentCountry.SelectedItem.ToString(); objEWA.PermanentState = ddlPermanentState.SelectedItem.ToString(); objEWA.PermanentCity = ddlPermanentCity.SelectedItem.ToString(); objEWA.PermanentPinCode = Convert.ToInt32(txtPermanentPinCode.Text); objEWA.PhoneNo = txtPhoneNumber.Text; objEWA.Mobile = txtMobileNumber.Text; objEWA.Fax = txtFaxNumber.Text; objEWA.Email = txtEmail.Text.Trim(); objEWA.CasteCategory = ddlCasteCategory.SelectedItem.ToString(); objEWA.Nationality = txtNationality.Text.Trim(); // objEWA.WebsiteBlog=txtwebsiteBlog.Text; objEWA.PanCardNo = txtPanCardNo.Text; objEWA.DateOfJoining = (txtJoiningDate.Text); objEWA.UGDegree = ddlUGDegree.SelectedItem.ToString(); objEWA.PGDegree = ddlPGDegree.SelectedItem.ToString(); objEWA.DoctrateDegree = txtDocterateDegree.Text.Trim(); objEWA.OtherQualification = txtOtherQualification.Text.Trim(); objEWA.Specialization = txtSpecialization.Text.Trim(); objEWA.TeachingExperience = txtTeachingExperience.Text.Trim(); objEWA.WebsiteBlog = txtWebsiteBlog.Text.Trim(); objEWA.PreviousPackage = txtPreviousPackage.Text; objEWA.PayScale = Convert.ToInt32(txtPayScale.Text); objEWA.SalaryMode = ddlSalaryMode.SelectedItem.ToString(); objEWA.PFNumber = txtPFNumber.Text.Trim(); objEWA.BankAccountNumber = txtAccountNumber.Text; objEWA.BankName = txtBankName.Text.Trim(); objEWA.BankBranchName = txtBranchName.Text.Trim(); objEWA.BankIFSCCode = txtIFSCCode.Text; //Insert data into User Table objEWA.UserType = "Staff"; objEWA.UserName = txtUserName.Text.Trim(); objEWA.Password = txtPassword.Text.Trim(); objEWA.Role = rbtnDesignationType.SelectedItem.ToString(); objEWA.UserTypeId = lblEmpCode.Text; objEWA.Status = "Permanent"; //Below Values Need to be pass from session objEWA.OrgId = orgId; // int length = 0; // byte[] imgLogobyte = null; //if (PhotoUpload.HasFile) //{ // length = PhotoUpload.PostedFile.ContentLength; // imgLogobyte = new byte[length]; // HttpPostedFile img1 = PhotoUpload.PostedFile; // img1.InputStream.Read(imgLogobyte, 0, length); //} //objEWA.Photo = imgLogobyte; if (PhotoUpload.HasFile) { string fileName = PhotoUpload.PostedFile.FileName; string fileExtension = System.IO.Path.GetExtension(fileName); string fileMimeType = PhotoUpload.PostedFile.ContentType; int fileLengthInKB = PhotoUpload.PostedFile.ContentLength / 1024; string[] matchExtension = { ".jpg", ".png", ".gif" }; string[] matchMimeType = { "image/jpeg", "image/png", "image/gif" }; if (matchExtension.Contains(fileExtension) && matchMimeType.Contains(fileMimeType)) { if (fileLengthInKB > 1024) { int length = PhotoUpload.PostedFile.ContentLength; objEWA.Photo = new byte[length]; HttpPostedFile img1 = PhotoUpload.PostedFile; img1.InputStream.Read(objEWA.Photo, 0, length); } else { //Please choose a file less than 1MB } } else { //Please choose only jpg, png or gif file. } } else { //Please choose a file. } objEWA.IsActive = "True"; DataTable data = objBL.StaffAction_BL(objEWA); if (data.Rows.Count > 0) { if (strAction == "Save") { SendEmails(); clear(); msgBox.ShowMessage("Staff Registered Successfully and Email Sent !!!", "Saved", UserControls.MessageBox.MessageStyle.Successfull); } } else { if (strAction == "Save") { msgBox.ShowMessage("Unable to Save !!!", "Critical", UserControls.MessageBox.MessageStyle.Critical); } } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
private void FillGridview() { gvMemberInfo.DataSource = BL_Staff.GetStaffDetail(1, BK_Session.GetSession().BranchId, "", ""); gvMemberInfo.DataBind(); }
//Perform Action for Employee #region [Perform Action] private void Action(string strAction) { EWA_Staff objEWA = new EWA_Staff(); BL_Staff objBL = new BL_Staff(); try { if (Session["StaffMob"] != null) { if (Session["StaffMob"].ToString() == (txtFirstName.Text.Trim() + txtMobileNumber.Text)) { //msgBox.ShowMessage("Record already present !!!", "Information", UserControls.MessageBox.MessageStyle.Successfull); //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Information", "alert('Admission Completed Successfully ')", true); Response.Redirect("~/Forms/Admin/Admin_Home.aspx?Msg=" + ViewState["msg"]); //return; } } else { Session["StaffMob"] = ((txtFirstName.Text.Trim() + txtMobileNumber.Text)); } objEWA.Action = strAction; //if (strAction == "Update" || strAction == "Delete") //{ // objEWA.StaffId = Convert.ToInt32(ViewState["DocumentId"].ToString()); //} //objEWA.EmpCode = lblEmpCode.Text; //objEWA.EmpCode = ViewState["EmpCode"].ToString(); objEWA.DesignationTypeId = rbtnDesignationType.SelectedValue; objEWA.FirstName = txtFirstName.Text.Trim(); objEWA.MiddleName = txtMiddleName.Text.Trim(); objEWA.LastName = txtLastName.Text.Trim(); objEWA.MotherName = txtMotherName.Text.Trim(); objEWA.Gender = rbtnGender.SelectedValue; objEWA.DOB = txt_BirthDate.Text; objEWA.BloodGroup = ddlBloodGroup.SelectedValue; objEWA.MaritalStatus = rbtnMaritalStatus.SelectedValue; //objEWA.Handicap = ddl_Handicap.SelectedValue; //objEWA.HandicapPercentage = Convert.ToInt32(txtHandicapPercentage.Text.Trim()); objEWA.PresentAddress = txtPresentAddress.Text.Trim(); objEWA.PresentCountry = ddlPresentCountry.SelectedItem.ToString(); objEWA.PresentState = ddlPresentState.SelectedItem.ToString(); objEWA.PresentCity = ddlPresentCity.SelectedItem.ToString(); objEWA.PresentPinCode = Convert.ToInt32(txtPresentPinCode.Text); //objEWA.PermanentAddress = txtPermanentAddress.Text.Trim(); //objEWA.PermanentCountry = txtPermanentCountry.Text; //objEWA.PermanentState = txtPermanentState.Text; //objEWA.PermanentCity = txtPermanentCity.Text; //objEWA.PermanentPinCode = Convert.ToInt32(txtPermanentPinCode.Text); objEWA.PhoneNo = txtPhoneNumber.Text; objEWA.Mobile = txtMobileNumber.Text; //objEWA.Fax = txtFaxNumber.Text; objEWA.Email = txtEmail.Text.Trim(); objEWA.CasteCategory = ddlCasteCategory.SelectedItem.ToString(); objEWA.Nationality = txtNationality.Text.Trim(); // objEWA.WebsiteBlog=txtwebsiteBlog.Text; objEWA.PanCardNo = txtPanCardNo.Text; objEWA.DateOfJoining = txtJoiningDate.Text; objEWA.UGDegree = txtUGDegree.Text; objEWA.PGDegree = txtPGDegree.Text; //objEWA.DoctrateDegree = txtDocterateDegree.Text.Trim(); objEWA.OtherQualification = txtOtherQualification.Text.Trim(); objEWA.Specialization = txtSpecialization.Text.Trim(); objEWA.TeachingExperience = txtTeachingExperience.Text.Trim(); //objEWA.WebsiteBlog = txtWebsiteBlog.Text.Trim(); //objEWA.PreviousPackage = txtPreviousPackage.Text; //objEWA.PayScale = Convert.ToInt32(txtPayScale.Text); //objEWA.SalaryMode = ddlSalaryMode.SelectedItem.ToString(); //objEWA.PFNumber = txtPFNumber.Text.Trim(); objEWA.BankAccountNumber = txtAccountNumber.Text; objEWA.BankName = txtBankName.Text.Trim(); objEWA.BankBranchName = txtBranchName.Text.Trim(); //objEWA.BankIFSCCode = txtIFSCCode.Text; //if (DDL_Role.SelectedItem.Text == "Staff") { objEWA.DepartmentId = ddlDepartment.SelectedValue; objEWA.DesignationId = ddlDesignation.SelectedValue; } //Insert data into User Table objEWA.UserType = DDL_Role.SelectedItem.Text; //objEWA.UserName = txtUserName.Text.Trim(); objEWA.Password = txtPassword.Text.Trim(); objEWA.Role = DDL_Role.SelectedItem.Text; //objEWA.UserTypeId = lblEmpCode.Text; objEWA.Status = "Permanent"; //Below Values Need to be pass from session objEWA.OrgId = orgId; objEWA.Photo = (byte[])ViewState["FacultyPhoto"]; if (PhotoUpload.HasFile) { string fileName = PhotoUpload.PostedFile.FileName; string fileExtension = System.IO.Path.GetExtension(fileName); string fileMimeType = PhotoUpload.PostedFile.ContentType; int fileLengthInKB = PhotoUpload.PostedFile.ContentLength / 1024; string[] matchExtension = { ".jpg", ".png", ".gif" }; string[] matchMimeType = { "image/jpeg", "image/png", "image/gif" }; if (matchExtension.Contains(fileExtension) && matchMimeType.Contains(fileMimeType)) { if (fileLengthInKB > 1024) { //int length = PhotoUpload.PostedFile.ContentLength; //objEWA.Photo = new byte[length]; //HttpPostedFile img1 = PhotoUpload.PostedFile; //img1.InputStream.Read(objEWA.Photo, 0, length); } else { //Please choose a file less than 1MB } } else { //Please choose only jpg, png or gif file. } } else { //Please choose a file. } objEWA.IsActive = "True"; DataTable data = objBL.StaffAction_BL(objEWA); if (data.Rows.Count > 0) { if (strAction == "Save") { //msgBox.ShowMessage("Staff Registered Successfully and Email Sent !!!", "Saved", UserControls.MessageBox.MessageStyle.Successfull); SendEmails(data.Rows[0][0].ToString(), data.Rows[0][1].ToString()); // System.Web.UI.ScriptManager.RegisterStartupScript(this, GetType(), "Saved", "alert('Staff Registered Successfully and Email Sent !!!');", true); //Response.Write("<script>alert('Staff Registered Successfully and Email Sent !!!')</script>"); clear(); ViewState["msg"] = data.Rows[0][0]; Response.Redirect("~/Forms/Admin/Admin_Home.aspx?Msg=" + data.Rows[0][0]); } } else { if (strAction == "Save") { msgBox.ShowMessage("Unable to Save !!!", "Critical", UserControls.MessageBox.MessageStyle.Critical); } } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }