Ejemplo n.º 1
0
 public void BaseDepartmentBind()
 {
     bl1.District_id = DDL_District.SelectedItem.Value;
     dt = dl1.Get_BaseDepartment(bl1);
     DDL_Department.DataSource     = dt.table;
     DDL_Department.DataTextField  = "dept_name";
     DDL_Department.DataValueField = "dept_id";
     DDL_Department.DataBind();
     DDL_Department.Items.Insert(0, new ListItem("--Select Department--", "0"));
 }
Ejemplo n.º 2
0
        //Bind Department
        #region [Bind Department]

        private void BindDepartment()
        {
            try
            {
                EWA_Common objEWA = new EWA_Common();
                BL_Common  objBL  = new BL_Common();
                objEWA.OrgId = Session["OrgId"].ToString();
                DataSet ds = objBL.BindDepartment_BL(objEWA);

                DDL_Department.DataSource     = ds;
                DDL_Department.DataTextField  = "DepartmentName";
                DDL_Department.DataValueField = "DepartmentId";
                DDL_Department.DataBind();
                DDL_Department.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select", "Select"));
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
            }
        }
Ejemplo n.º 3
0
        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());
            }
        }