private void BindDesignation() { try { EWA_Common objEWA = new EWA_Common(); BL_Common objBL = new BL_Common(); objEWA.OrgId = Session["OrgId"].ToString(); objEWA.DepartmentId = DDL_Department.SelectedValue.ToString(); objEWA.DesignationTypeId = rbtnFacultyType.SelectedItem.Value; //RadioButtonList rbtnList = Page.FindControl("rbtnFacultyType") as RadioButtonList; //string str= rbtnList.SelectedValue; DataSet ds = objBL.BindDesignation_BL(objEWA); DDL_Designation.DataSource = ds; DDL_Designation.DataTextField = "DesignationName"; DDL_Designation.DataValueField = "DesignationId"; DDL_Designation.DataBind(); DDL_Designation.Items.Insert(0, "Select"); DDL_Designation.SelectedIndex = 0; DDL_Designation.DataSource = null; DDL_Designation.DataBind(); } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }
protected void btnPostSalary_Click(object sender, EventArgs e) { BL_SalarySettings objBL = new BL_SalarySettings(); EWA_SalarySettings objEWA = new EWA_SalarySettings(); try { objEWA.EmployeeName = DDL_EmoloyeeName.SelectedItem.ToString(); objEWA.UserCode = DDL_EmoloyeeName.SelectedValue.ToString(); objEWA.Department = DDL_Department.SelectedItem.ToString(); objEWA.Designation = DDL_Designation.SelectedItem.ToString(); objEWA.SalaryMonth = txtMonth.Text.ToString(); objEWA.PostedMonth = Convert.ToDateTime(txtMonth.Text).ToString(); objEWA.BasicSalary = txtBasicSalary; objEWA.GorssSalary = txtGrossSalary; objEWA.TotalDeduction = txtDeductions; objEWA.LeaveDeduction = 0;//Convert.ToDouble(txtTotalLeave.Text); objEWA.NetSalary = txtNetSalary; objEWA.OrgId = Convert.ToInt32(Session["OrgId"]); objEWA.AcademicYearId = Convert.ToInt32(Session["AcademicYearId"]); objEWA.Action = "SalarySlipSave"; // CREATING DATA TABLE FOR GRID VIEW DataTable DataSalaryEarning = new DataTable(); DataSalaryEarning.Columns.Add("CategoryName"); DataSalaryEarning.Columns.Add("ContentValue"); DataSalaryEarning.Columns.Add("ContentAction"); string CategoryName, ContentValue, ContentAction; //foreach (GridViewRow gvrow in GridView1.Rows) //{ // CategoryName = GridView1.Rows[gvrow.RowIndex].Cells[0].Text; // if (GridView1.Rows[gvrow.RowIndex].Cells[1].Text != null) // { // ContentValue = GridView1.Rows[gvrow.RowIndex].Cells[1].Text; // DataSalaryEarning.Rows.Add(CategoryName, ContentValue, "Earning"); // } // else // { // ContentValue = GridView1.Rows[gvrow.RowIndex].Cells[2].Text; // DataSalaryEarning.Rows.Add(CategoryName, ContentValue, "Deduction"); // } // i++; //} //foreach (GridViewRow gvrow in grdDeduction.Rows) //{ // CategoryName = grdDeduction.Rows[gvrow.RowIndex].Cells[1].Text; // ContentValue = grdDeduction.Rows[gvrow.RowIndex].Cells[2].Text; // DataSalaryEarning.Rows.Add(CategoryName, ContentValue,"Deduction"); // i++; //} int flag = objBL.SaveSalarySlip(objEWA, DataSalaryEarning); DataSet dss = new DataSet(); DataSet dss1 = new DataSet(); if (flag > 0) { database db = new database(); for (int i = 0; (GridView1.Rows.Count - 2) > i; i++) { CategoryName = GridView1.Rows[i].Cells[0].Text; string date = DateTime.Now.ToShortDateString(); if (GridView1.Rows[i].Cells[1].Text != " ") { ContentValue = GridView1.Rows[i].Cells[1].Text; ContentAction = "Earning"; //db.insert("INSERT INTO tblPostSalaryContents (SalarySleepID,CategoryName,ContentValue,ContentAction,TransDate,AcademicYearId,IsActive) " + // "values('" + flag + "','" + CategoryName + "','" + ContentValue + "','" + ContentAction + "','" + date + "','" + Convert.ToInt32(Session["AcademicYearId"]) + "',1)"); } else { ContentValue = GridView1.Rows[i].Cells[2].Text; ContentAction = "Deduction"; //db.insert("INSERT INTO tblPostSalaryContents (SalarySleepID,CategoryName,ContentValue,ContentAction,TransDate,AcademicYearId,IsActive) " + // "values('" + flag + "','" + CategoryName + "','" + ContentValue + "','" + ContentAction + "','" + date + "','" + Convert.ToInt32(Session["AcademicYearId"]) + "',1)"); } objEWA.ContentValue = ContentValue; objEWA.ContentAction = ContentAction; objEWA.SalarySleepID = flag.ToString(); objEWA.CategoryName = CategoryName; dss1 = objBL.SaveSalaryContent(objEWA); } if (dss1.Tables[0].Rows.Count > 0) { if (dss1.Tables[0].Rows[0]["TokenId"].ToString() != "") { if (dss1.Tables[1].Rows[0]["SenderId"].ToString() != "") { SendPushNotification(dss1.Tables[0].Rows[0]["TokenId"].ToString(), dss1.Tables[0].Rows[0]["Subject"].ToString(), dss1.Tables[0].Rows[0]["OrgName"].ToString(), dss1.Tables[1].Rows[0]["SenderId"].ToString(), dss1.Tables[1].Rows[0]["AppKey"].ToString()); } } } txtMonth.Text = string.Empty; DDL_Department.ClearSelection(); rbtnFacultyType.ClearSelection(); DDL_Designation.ClearSelection(); DDL_EmoloyeeName.ClearSelection(); Panel2.Visible = false; btnPostSalary.Visible = false; btnPrintSalarySlip.Visible = false; msgBox.ShowMessage("Salary Posted Successfully !!!", "Saved", UserControls.MessageBox.MessageStyle.Successfull); } else { if (objEWA.Action == "Save") { msgBox.ShowMessage("Unable to Save !!!", "Critical", UserControls.MessageBox.MessageStyle.Critical); } if (objEWA.Action == "SalarySlipSave" && flag == 0) { Panel2.Visible = false; btnPostSalary.Visible = false; btnPrintSalarySlip.Visible = false; msgBox.ShowMessage("Salary already Posted !!!", "Information", UserControls.MessageBox.MessageStyle.Information); } } } catch (Exception exp) { GeneralErr(exp.Message.ToString()); } }