private void loaddropdowns()
    {
        try
        {
            //load businessunit.
            rcmb_BusinessUnit.Items.Clear();
            _obj_SMHR_LoginInfo = new SMHR_LOGININFO();
            _obj_SMHR_LoginInfo.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
            _obj_SMHR_LoginInfo.LOGIN_ID        = Convert.ToInt32(Session["USER_ID"]);
            DataTable dt_BUDetails = BLL.get_Business_Units(_obj_SMHR_LoginInfo);
            rcmb_BusinessUnit.DataSource     = dt_BUDetails;
            rcmb_BusinessUnit.DataTextField  = "BUSINESSUNIT_CODE";
            rcmb_BusinessUnit.DataValueField = "BUSINESSUNIT_ID";
            rcmb_BusinessUnit.DataBind();
            rcmb_BusinessUnit.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("Select", "-1"));


            //load leave type for which CompOff is allowed.
            SMHR_LEAVEMASTER _obj_smhr_leavemaster = new SMHR_LEAVEMASTER();
            _obj_smhr_leavemaster.OPERATION       = operation.Empty;
            _obj_smhr_leavemaster.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
            DataTable dtid = new DataTable();
            dtid = BLL.get_LeaveMaster(_obj_smhr_leavemaster);
            rcmb_Compoff.DataSource     = dtid;
            rcmb_Compoff.DataValueField = "LEAVEMASTER_ID";
            rcmb_Compoff.DataTextField  = "LEAVEMASTER_CODE";
            rcmb_Compoff.DataBind();
            rcmb_Compoff.Items.Insert(0, new RadComboBoxItem("Select", "-1"));
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_comoffrequest", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
Esempio n. 2
0
 public void LoadGrid()
 {
     try
     {
         SMHR_LEAVEMASTER _obj_smhr_leavemaster = new SMHR_LEAVEMASTER();
         _obj_smhr_leavemaster.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"].ToString());
         DataTable DT = BLL.get_LeaveMaster(_obj_smhr_leavemaster);
         RG_LeaveMaster.DataSource = DT;
     }
     catch (Exception ex)
     {
         SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_LeaveMaster", ex.StackTrace, DateTime.Now);
         Response.Redirect("~/Frm_ErrorPage.aspx");
     }
     //clearControls();
 }
 protected void LoadLeaveTypes()
 {
     try
     {
         rcmb_Leaves.Items.Clear();
         SMHR_LEAVEMASTER _obj_Smhr_LeaveMaster = new SMHR_LEAVEMASTER();
         _obj_Smhr_LeaveMaster.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
         rcmb_Leaves.DataSource     = BLL.get_LeaveMaster(_obj_Smhr_LeaveMaster);
         rcmb_Leaves.DataTextField  = "LEAVEMASTER_CODE";
         rcmb_Leaves.DataValueField = "LEAVEMASTER_ID";
         rcmb_Leaves.DataBind();
         rcmb_Leaves.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("Select", "-1"));
     }
     catch (Exception ex)
     {
         SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_leavetran", ex.StackTrace, DateTime.Now);
         Response.Redirect("~/Frm_ErrorPage.aspx");
     }
 }
Esempio n. 4
0
    //protected void Btn_Imp_LeaveMaster_click(object sender, EventArgs e)
    //{
    //    try
    //    {
    //        // written by Rajasekhar
    //        // to import LeaveMaster details
    //        string strcon = null;

    //        string strfilename1 = FileUpload1.FileName;
    //        strfilename2 = Convert.ToString(DateTime.Now.TimeOfDay) + "_" + strfilename1;
    //        strfilename2 = strfilename2.Replace("/", "").Replace(":", ".");
    //        if (FileUpload1.HasFile)
    //        {

    //            if (System.IO.Directory.Exists(Server.MapPath("~/IMPORT_EXCEL/")) == false)
    //            {
    //                System.IO.Directory.CreateDirectory(Server.MapPath("~/IMPORT_EXCEL/"));

    //            }



    //            FileUpload1.PostedFile.SaveAs(System.IO.Path.Combine(Server.MapPath("~/IMPORT_EXCEL/"), strfilename2));
    //            string filename1 = Server.MapPath("~/IMPORT_EXCEL/") + ("") + (Convert.ToString(strfilename2));
    //            FileInfo fileInfo = new FileInfo(filename1);
    //            if (fileInfo.Exists)
    //            {
    //                string path = MapPath(strfilename1);
    //                // string name = Path.GetFileName( path );
    //                string ext = Path.GetExtension(path);

    //                string type = string.Empty;
    //                //  set known types based on file extension
    //                if (ext != null)
    //                {
    //                    switch (ext.ToLower())
    //                    {

    //                        case ".xls":

    //                            type = "excel";
    //                            break;
    //                        case ".xlsx":
    //                            type = "excel";
    //                            break;

    //                        default:
    //                            type = string.Empty;
    //                            break;
    //                    }
    //                }
    //                if (type == string.Empty)
    //                {
    //                    if (System.IO.Directory.Exists(Server.MapPath("~/IMPORT_EXCEL/")) == true)
    //                    {

    //                        string path1 = Server.MapPath("~/IMPORT_EXCEL/") + ("") + (Convert.ToString(strfilename2));
    //                        System.IO.File.Delete(path1);
    //                    }
    //                    BLL.ShowMessage(this, "Please select the Excel File  (Eg: Excel.xlsx). ");
    //                    return;
    //                }
    //            }
    //        }


    //        else
    //        {
    //            BLL.ShowMessage(this, "Please Select the File to be uploaded");
    //            return;
    //        }

    //        string strpath = Server.MapPath("~/IMPORT_EXCEL/");

    //        strpath = strpath + strfilename2;


    //        // Getting data from excell file to dataset.
    //        strcon = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source='" + strpath + "';" + "Extended Properties=Excel 12.0;";


    //        OleDbConnection objConn = null;
    //        objConn = new OleDbConnection(strcon);
    //        objConn.Open();

    //        DataTable dt_chk2 = objConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
    //        string sheetname;
    //        if (dt_chk2 == null)
    //        {
    //            objConn.Close();
    //            Delete_Excel_File();
    //            BLL.ShowMessage(this, "Please select the Correct Excel Template  Sheet.");
    //            return;
    //        }
    //        else
    //        {
    //            sheetname = Convert.ToString(dt_chk2.Rows[0]["TABLE_NAME"]);
    //        }
    //        OleDbDataAdapter da = new OleDbDataAdapter("SELECT * FROM  [" + sheetname + "]", strcon);



    //        da.Fill(ds);
    //        ds.Tables[0].Columns.Add("Error Message");

    //        objConn.Close();
    //        DataTable dt = new DataTable();
    //        DataTable dtfail = new DataTable();


    //        string errormsg = string.Empty;


    //        Int32 rowno = 0;


    //        string columnno = null;

    //        Boolean filestatus = true;
    //        dtfail.Columns.Add("S.NO", typeof(Int32));
    //        dtfail.Columns.Add("ROWNO", typeof(Int32));
    //        dtfail.Columns.Add("COLUMNS NAMES", typeof(string));

    //        if (ds.Tables[0].Columns[0].ToString().Trim() == "Name*")
    //        {
    //        }
    //        else
    //        {
    //            Delete_Excel_File();
    //            BLL.ShowMessage(this, "Please select the Correct Excel Template  Sheet.");
    //            return;

    //        }

    //        if (ds.Tables[0].Columns[1].ToString().Trim() == "Description")
    //        {
    //        }
    //        else
    //        {
    //            Delete_Excel_File();
    //            BLL.ShowMessage(this, "Please select the Correct Excel Template  Sheet.");
    //            return;

    //        }
    //        if (ds.Tables[0].Columns[2].ToString().Trim() == "Check Comp Off")
    //        {
    //        }
    //        else
    //        {
    //            Delete_Excel_File();
    //            BLL.ShowMessage(this, "Please select the Correct Excel Template  Sheet.");
    //            return;

    //        }
    //        if (ds.Tables[0].Rows.Count == 0)
    //        {
    //            Delete_Excel_File();
    //            BLL.ShowMessage(this, "Successfully processed Excel file. No Records are Imported.");
    //            return;
    //        }
    //        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
    //        {
    //            errormsg = string.Empty;
    //            columnno = string.Empty;

    //            if (ds.Tables[0].Rows[i]["Name*"].ToString().Trim() != "")
    //            {
    //                SMHR_LEAVEMASTER _obj_smhr_leavemaster = new SMHR_LEAVEMASTER();
    //                _obj_smhr_leavemaster.LEAVEMASTER_CODE = ds.Tables[0].Rows[i]["Name*"].ToString().Trim();
    //                _obj_smhr_leavemaster.OPERATION = operation.Check;
    //                _obj_smhr_leavemaster.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
    //                if (Convert.ToString(BLL.get_LeaveMaster(_obj_smhr_leavemaster).Rows[0]["Count"]) != "0")
    //                {
    //                    errormsg = "Leave Type with this name Already Exists";
    //                    filestatus = false;
    //                    rowno = i + 2;
    //                    columnno = "Name*";

    //                }
    //                else
    //                {
    //                }

    //            }
    //            else
    //            {
    //                filestatus = false;
    //                rowno = i + 2;
    //                columnno = "Name*";
    //            }

    //            if (filestatus == false)
    //            {
    //                DataRow newrow = dtfail.NewRow();
    //                newrow["S.NO"] = dtfail.Rows.Count + 1;


    //                newrow["ROWNO"] = rowno;
    //                newrow["COLUMNS NAMES"] = columnno;
    //                dtfail.Rows.Add(newrow);
    //                ds.Tables[0].Rows[i]["Error Message"] = errormsg;
    //            }
    //        }

    //        if (dtfail.Rows.Count > 0)
    //        {
    //            Session["dt_fail"] = dtfail;
    //            Session["ds_data"] = ds;
    //            Delete_Excel_File();
    //            //LinkButton lnk_Import_process = (LinkButton)RadPanelBar1.FindItemByValue("AddAttachment").FindControl("lnk_Import_process");
    //            Telerik.Web.UI.RadWindow newwindow = new Telerik.Web.UI.RadWindow();
    //            // RWM_POSTREPLY.Windows.Remove(newwindow);
    //            newwindow.ID = "RadWindow_import";

    //            newwindow.NavigateUrl = "~/Payroll/frm_AttendanceImportProcess.aspx";
    //            newwindow.Title = "Import Process";
    //            newwindow.Width = 1150;
    //            newwindow.Height = 580;
    //            newwindow.VisibleOnPageLoad = true;
    //            if (RWM_POSTREPLY1.Windows.Count > 1)
    //            {
    //                RWM_POSTREPLY1.Windows.RemoveAt(1);
    //            }
    //            RWM_POSTREPLY1.Windows.Add(newwindow);



    //            RWM_POSTREPLY1.Visible = true;
    //            return;

    //        }
    //        else
    //        {
    //            bool status = false;

    //            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
    //            {

    //                SMHR_LEAVEMASTER _obj_smhr_leavemaster = new SMHR_LEAVEMASTER();
    //                _obj_smhr_leavemaster = new SMHR_LEAVEMASTER();
    //                _obj_smhr_leavemaster.LEAVEMASTER_CODE = ds.Tables[0].Rows[i]["Name*"].ToString().Trim();
    //                _obj_smhr_leavemaster.LEAVEMASTER_DESCRIPTION = ds.Tables[0].Rows[i]["Description"].ToString().Trim();
    //                _obj_smhr_leavemaster.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"].ToString());

    //                _obj_smhr_leavemaster.CREATEDBY = Convert.ToInt32(Session["USER_ID"]); // ### Need to Get the Session
    //                _obj_smhr_leavemaster.CREATEDDATE = DateTime.Now;

    //                _obj_smhr_leavemaster.LASTMDFBY = Convert.ToInt32(Session["USER_ID"]); // ### Need to Get the Session
    //                _obj_smhr_leavemaster.LASTMDFDATE = DateTime.Now;
    //                _obj_smhr_leavemaster.OPERATION = operation.Insert;
    //                status = BLL.set_LeaveMaster(_obj_smhr_leavemaster);
    //            }
    //            if (status == true)

    //                BLL.ShowMessage(this, "Information Saved Successfully");
    //            LoadGrid();
    //            RG_LeaveMaster.DataBind();
    //        }

    //    }
    //    catch (Exception ex)
    //    {
    //        throw ex;

    //    }

    //}
    protected void AllowPay_click(object sender, EventArgs e)
    {
        try
        {
            if (rtxt_LeaveMasterCode.Text != string.Empty)
            {
                SMHR_LEAVEMASTER _obj_smhr_leavemaster = new SMHR_LEAVEMASTER();


                _obj_smhr_leavemaster.OPERATION        = operation.Delete;
                _obj_smhr_leavemaster.ORGANISATION_ID  = Convert.ToInt32(Session["ORG_ID"].ToString());
                _obj_smhr_leavemaster.LEAVEMASTER_CODE = rtxt_LeaveMasterCode.Text;
                DataTable dt = BLL.get_LeaveMaster(_obj_smhr_leavemaster);
                if (chk_allowpay.Checked)
                {
                    if (dt.Rows.Count != 0)
                    {
                        if (Convert.ToInt32(dt.Rows[0]["count"]) != 0)
                        {
                            chk_allowpay.Checked = false;
                            BLL.ShowMessage(this, " Already Exists");

                            return;
                        }
                    }
                    else
                    {
                    }
                }
            }
            else
            {
                BLL.ShowMessage(this, "Please Enter Name");
                return;
            }
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_LeaveMaster", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
Esempio n. 5
0
    protected void chk_IncidentLeave_CheckedChanged(object sender, EventArgs e)
    {
        try
        {
            if (rtxt_LeaveMasterCode.Text != string.Empty)
            {
                if (chk_IncidentLeave.Checked)
                {
                    SMHR_LEAVEMASTER _obj_smhr_leavemaster = new SMHR_LEAVEMASTER();
                    _obj_smhr_leavemaster.OPERATION        = operation.CHECKEXISTS;
                    _obj_smhr_leavemaster.ORGANISATION_ID  = Convert.ToInt32(Session["ORG_ID"].ToString());
                    _obj_smhr_leavemaster.LEAVEMASTER_CODE = rtxt_LeaveMasterCode.Text;
                    DataTable dt = BLL.get_LeaveMaster(_obj_smhr_leavemaster);  //To check if any Incident leavetype exists

                    if (dt.Rows.Count != 0)
                    {   //If exists then, must not allow to insert again
                        {
                            if (Convert.ToInt32(dt.Rows[0]["count"]) != 0)
                            {
                                chk_IncidentLeave.Checked = false;
                                BLL.ShowMessage(this, "Already Exists");
                                return;
                            }
                        }
                    }
                }
            }
            else
            {
                BLL.ShowMessage(this, "Please Enter Name");
                return;
            }
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_LeaveMaster", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
Esempio n. 6
0
    protected void btn_Save_Click1(object sender, EventArgs e)
    {
        try
        {
            SMHR_LEAVEMASTER _obj_smhr_leavemaster = new SMHR_LEAVEMASTER();
            //_obj_smhr_leavemaster = new SMHR_LEAVEMASTER();
            _obj_smhr_leavemaster.LEAVEMASTER_CODE        = BLL.ReplaceQuote(rtxt_LeaveMasterCode.Text);
            _obj_smhr_leavemaster.LEAVEMASTER_DESCRIPTION = BLL.ReplaceQuote(rtxt_LeaveMasterDesc.Text);
            _obj_smhr_leavemaster.ORGANISATION_ID         = Convert.ToInt32(Session["ORG_ID"].ToString());
            if (chk_allowpay.Checked)
            {
                _obj_smhr_leavemaster.LEAVEMASTER_ALLOWPAY = true;
            }
            else
            {
                _obj_smhr_leavemaster.LEAVEMASTER_ALLOWPAY = false;
            }
            if (rchk_compoff.Checked)
            {
                _obj_smhr_leavemaster.LEAVEMASTER_COMPOFF = 1;
            }
            else
            {
                _obj_smhr_leavemaster.LEAVEMASTER_COMPOFF = 0;
            }
            if (chk_IncidentLeave.Checked)
            {
                _obj_smhr_leavemaster.LEAVEMASTER_ISINCIDENT = true;
            }
            else
            {
                _obj_smhr_leavemaster.LEAVEMASTER_ISINCIDENT = false;
            }


            _obj_smhr_leavemaster.CREATEDBY   = Convert.ToInt32(Session["USER_ID"]); // ### Need to Get the Session
            _obj_smhr_leavemaster.CREATEDDATE = DateTime.Now;

            _obj_smhr_leavemaster.LASTMDFBY   = Convert.ToInt32(Session["USER_ID"]); // ### Need to Get the Session
            _obj_smhr_leavemaster.LASTMDFDATE = DateTime.Now;

            switch (((Button)sender).ID.ToUpper())
            {
            case "BTN_EDIT":
                _obj_smhr_leavemaster.LEAVEMASTER_ID = Convert.ToInt32(lbl_LeaveMaster_ID.Text);
                _obj_smhr_leavemaster.OPERATION      = operation.Check;
                if (Convert.ToString(BLL.get_LeaveMaster(_obj_smhr_leavemaster).Rows[0]["Count"]) != "1")
                {
                    BLL.ShowMessage(this, "Leave Type with this name Already Exists");
                    return;
                }
                _obj_smhr_leavemaster.LEAVEMASTER_ID = Convert.ToInt32(lbl_LeaveMaster_ID.Text);
                _obj_smhr_leavemaster.OPERATION      = operation.Update;
                if (BLL.set_LeaveMaster(_obj_smhr_leavemaster))
                {
                    BLL.ShowMessage(this, "Information Updated Successfully");
                }
                else
                {
                    BLL.ShowMessage(this, " Leave Type Not Saved");
                }

                break;

            case "BTN_SAVE":
                _obj_smhr_leavemaster.OPERATION       = operation.Check;
                _obj_smhr_leavemaster.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]);
                if (Convert.ToString(BLL.get_LeaveMaster(_obj_smhr_leavemaster).Rows[0]["Count"]) != "0")
                {
                    BLL.ShowMessage(this, "Leave Type with this name Already Exists");
                    return;
                }
                _obj_smhr_leavemaster.OPERATION = operation.Insert;
                if (BLL.set_LeaveMaster(_obj_smhr_leavemaster))
                {
                    BLL.ShowMessage(this, "Information Saved Successfully");
                }
                else
                {
                    BLL.ShowMessage(this, "Leave Type Not Saved");
                }
                break;

            default:
                break;
            }
            rm_MR_Page.SelectedIndex = 0;
            LoadGrid();
            RG_LeaveMaster.DataBind();
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_LeaveMaster", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }