예제 #1
0
        /// <summary>
        /// gdvAttendance_RowDataBound
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gdvAttendance_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                DropDownList DropDownList1 = (e.Row.FindControl("ddlL1Remarks") as DropDownList);
                EmpBL        ObjEmp        = new EmpBL();
                DataTable    dt            = ObjEmp.GetRemarks();

                DropDownList1.DataSource     = dt;
                DropDownList1.DataTextField  = "Description";
                DropDownList1.DataValueField = "Id";
                DropDownList1.DataBind();
                DropDownList1.Items.Insert(0, new System.Web.UI.WebControls.ListItem("--Select--", "0"));

                if (Session["Privilege"].ToString() == "L1")
                {
                    TextBox TextBox1 = (e.Row.FindControl("txtL2Remarks") as TextBox);
                    TextBox1.Enabled = false;

                    CheckBox CheckBox1 = (e.Row.FindControl("chkLevel2") as CheckBox);
                    CheckBox1.Enabled = false;
                }

                if (Session["Privilege"].ToString() == "L2")
                {
                    DropDownList DropDownList2 = (e.Row.FindControl("ddlL1Remarks") as DropDownList);
                    DropDownList2.Enabled = false;
                    DropDownList2.Visible = false;

                    CheckBox CheckBox1 = (e.Row.FindControl("chkLevel1") as CheckBox);
                    CheckBox1.Enabled = false;
                }
            }
        }
예제 #2
0
        /// <summary>
        /// ImportEmployeeData
        /// </summary>
        private void ImportEmployeeData()
        {
            String path     = Server.MapPath("~/FileImport/");
            Random rnd      = new Random();
            String fileName = "Employee_Data" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + "_" + rnd.Next() + ".csv";

            fileuploadExcel.PostedFile.SaveAs(path
                                              + fileName);

            //FileStream stream = File.Open(path + fileName, FileMode.Open, FileAccess.Read);

            DataTable dtImport  = CsvReader.ReadCSVFile(path + fileName, true);
            EmpBL     ObjImport = new EmpBL();

            ObjImport.DtSource = dtImport;
            Boolean Result = ObjImport.ImportEmployeeData();


            if (Result)
            {
                lblMessage.Text      = "Successfully Imported!";
                lblMessage.ForeColor = Color.Green;
            }
            else
            {
                lblMessage.Text      = "Faild!";
                lblMessage.ForeColor = Color.Red;
            }
        }
예제 #3
0
        /// <summary>
        /// gdvSchedule_RowDataBound
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gdvSchedule_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                DropDownList DropDownList1 = (e.Row.FindControl("ddlShiftId1") as DropDownList);
                DropDownList DropDownList2 = (e.Row.FindControl("ddlShiftId2") as DropDownList);
                DropDownList DropDownList3 = (e.Row.FindControl("ddlShiftId3") as DropDownList);
                DropDownList DropDownList4 = (e.Row.FindControl("ddlShiftId4") as DropDownList);

                DropDownList DropDownList5 = (e.Row.FindControl("ddlShiftId5") as DropDownList);
                DropDownList DropDownList6 = (e.Row.FindControl("ddlShiftId6") as DropDownList);
                DropDownList DropDownList7 = (e.Row.FindControl("ddlShiftId7") as DropDownList);

                EmpBL     ObjEmp = new EmpBL();
                DataTable dt     = ObjEmp.GetShiftMaster();

                DropDownList1.DataSource     = dt;
                DropDownList1.DataTextField  = "Description";
                DropDownList1.DataValueField = "ShiftHeaderId";
                DropDownList1.DataBind();
                DropDownList1.Items.Insert(0, new ListItem("--Select Shift Id--", "0"));

                DropDownList2.DataSource     = dt;
                DropDownList2.DataTextField  = "Description";
                DropDownList2.DataValueField = "ShiftHeaderId";
                DropDownList2.DataBind();
                DropDownList2.Items.Insert(0, new ListItem("--Select Shift Id--", "0"));

                DropDownList3.DataSource     = dt;
                DropDownList3.DataTextField  = "Description";
                DropDownList3.DataValueField = "ShiftHeaderId";
                DropDownList3.DataBind();
                DropDownList3.Items.Insert(0, new ListItem("--Select Shift Id--", "0"));

                DropDownList4.DataSource     = dt;
                DropDownList4.DataTextField  = "Description";
                DropDownList4.DataValueField = "ShiftHeaderId";
                DropDownList4.DataBind();
                DropDownList4.Items.Insert(0, new ListItem("--Select Shift Id--", "0"));


                DropDownList5.DataSource     = dt;
                DropDownList5.DataTextField  = "Description";
                DropDownList5.DataValueField = "ShiftHeaderId";
                DropDownList5.DataBind();
                DropDownList5.Items.Insert(0, new ListItem("--Select Shift Id--", "0"));

                DropDownList6.DataSource     = dt;
                DropDownList6.DataTextField  = "Description";
                DropDownList6.DataValueField = "ShiftHeaderId";
                DropDownList6.DataBind();
                DropDownList6.Items.Insert(0, new ListItem("--Select Shift Id--", "0"));

                DropDownList7.DataSource     = dt;
                DropDownList7.DataTextField  = "Description";
                DropDownList7.DataValueField = "ShiftHeaderId";
                DropDownList7.DataBind();
                DropDownList7.Items.Insert(0, new ListItem("--Select Shift Id--", "0"));
            }
        }
예제 #4
0
        /// <summary>
        /// btnReport_Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnReport_Click(object sender, EventArgs e)
        {
            DataTable dt     = null;
            EmpBL     objEmp = new EmpBL();
            Random    rnd    = new Random();

            objEmp.Date         = DateTime.ParseExact(txtDate.Text.Trim().ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture);
            objEmp.WorkLocation = Session["Location"].ToString();
            objEmp.ReportType   = rblType.SelectedItem.Value;

            if (rblType.SelectedItem.Value == "2")
            {
                dt = objEmp.GetAttendanceLineByDate();
                string filePath = Server.MapPath(".") + "\\Reports\\Attendance_Weekly" + "_" + rnd.Next() + ".csv";
                ViewState["FileNameAtt"] = filePath;
                StreamWriter sw = new StreamWriter(@filePath, false);
                ExportToCsv(dt, sw);
                sw.Close();
                btnDownload.Visible = true;
            }
            else if (rblType.SelectedItem.Value == "3")
            {
                dt = objEmp.GetAttendanceLineByDate();
                string filePath = Server.MapPath(".") + "\\Reports\\Attendance_Monthly" + "_" + rnd.Next() + ".csv";
                ViewState["FileNameAtt"] = filePath;
                StreamWriter sw = new StreamWriter(@filePath, false);
                ExportToCsv(dt, sw);
                sw.Close();
                btnDownload.Visible = true;
            }
            else
            {
                ExportAttendance();
            }
        }
예제 #5
0
        /// <summary>
        /// btnSchdule_Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSchdule_Click(object sender, EventArgs e)
        {
            EmpBL ObjEmp = new EmpBL();

            ObjEmp.FromDate     = DateTime.ParseExact(txtFromDate.Text.Trim().ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture);
            ObjEmp.ToDate       = DateTime.ParseExact(txtToDate.Text.Trim().ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture);
            ObjEmp.WorkLocation = Session["Location"].ToString();
            DataTable dt = ObjEmp.GetEmpSchedule();

            if (dt.Rows.Count > 0)
            {
                lblMessage.Text      = "Schedule is already uploaded!";
                lblMessage.ForeColor = System.Drawing.Color.Red;
                btnSave.Visible      = false;
                gdvSchedule.Visible  = false;
            }
            else if (DateTime.Now.DayOfWeek.ToString() != "Saturday" && DateTime.Now.DayOfWeek.ToString() != "Sunday")
            {
                lblMessage.Text      = "You can not upload schedule today! (Sat Or Sun)";
                lblMessage.ForeColor = System.Drawing.Color.Red;
                btnSave.Visible      = false;
                gdvSchedule.Visible  = false;
            }
            else
            {
                BindScheduleData();
                gdvSchedule.Visible = true;
                lblMessage.Text     = "";
                btnSave.Visible     = true;
            }
        }
예제 #6
0
        /// <summary>
        /// btnGenerate_Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnGenerate_Click(object sender, EventArgs e)
        {
            EmpBL     ObjEmp             = new EmpBL();
            DataTable dt                 = ObjEmp.GetCustomer();
            int       vouchersToGenerate = dt.Rows.Count;
            int       lengthOfVoucher    = 5;

            List <string> generatedVouchers = new List <string>();

            char[] keys = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray();

            //  Console.WriteLine("Vouchers: ");
            int i = 0;

            while (generatedVouchers.Count < vouchersToGenerate)
            {
                var voucher = GenerateVoucher(keys, lengthOfVoucher);
                if (!generatedVouchers.Contains(voucher))
                {
                    generatedVouchers.Add(voucher);

                    ObjEmp.OfferCode  = voucher;
                    ObjEmp.ValidUntil = Convert.ToDateTime(txtValidUntil.Text.Trim().ToString());
                    //DateTime.ParseExact(txtValidUntil.Text.Trim().ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture);
                    ObjEmp.MobileNo = Convert.ToDecimal(dt.Rows[i]["MobileNo"].ToString());
                    bool Result = ObjEmp.InsertOffer();

                    if (Result)
                    {
                        i++;
                    }
                    //Console.WriteLine("\t[#{0}] {1}", generatedVouchers.Count, voucher);
                }
            }
        }
예제 #7
0
        /// <summary>
        /// Bind Emp Details
        /// </summary>
        private void BindEmpDetails()
        {
            EmpBL objEmp = new EmpBL();

            objEmp.EmpId = ddlEmpId.SelectedItem.Value;
            DataTable dt = objEmp.GetAllEmployeeInfoByEmpId();

            if (dt.Rows.Count > 0)
            {
                txtFirstName.Text  = dt.Rows[0]["FirstName"].ToString();
                txtMiddleName.Text = dt.Rows[0]["MiddleName"].ToString();
                txtLastName.Text   = dt.Rows[0]["LastName"].ToString();
                txtDOB.Text        = Convert.ToDateTime(dt.Rows[0]["DOB"].ToString()).ToShortDateString();

                ddlGender.Text           = dt.Rows[0]["Gender"].ToString();
                txtPresentAddress.Text   = dt.Rows[0]["PresentAddress"].ToString();
                txtPermanentAddress.Text = dt.Rows[0]["PermanentAddress"].ToString();
                txtJoiningDate.Text      = Convert.ToDateTime(dt.Rows[0]["JoiningDate"].ToString()).ToShortDateString();

                ddlMaritalStatus.Text = dt.Rows[0]["MaritalStatus"].ToString();
                txtNationality.Text   = dt.Rows[0]["Nationality"].ToString();
                txtPhoneNo.Text       = dt.Rows[0]["Phone1"].ToString();
                txtPhoneHome.Text     = dt.Rows[0]["Phone(HomeCountry)"].ToString();

                txtEmail.Text             = dt.Rows[0]["Email1"].ToString();
                txtDestinationCity.Text   = dt.Rows[0]["Designation"].ToString();
                txtPassportNo.Text        = dt.Rows[0]["PassportNo"].ToString();
                txtPassportValidFrom.Text = Convert.ToDateTime(dt.Rows[0]["PassportValidFrom"].ToString()).ToShortDateString();

                txtPassportValidTill.Text = Convert.ToDateTime(dt.Rows[0]["PassportValidTill"].ToString()).ToShortDateString();
                txtVisaNo.Text            = dt.Rows[0]["VisaNo"].ToString();
                txtVisaType.Text          = dt.Rows[0]["VisaType"].ToString();
                txtVisaValidFrom.Text     = Convert.ToDateTime(dt.Rows[0]["VisaValidFrom"].ToString()).ToShortDateString();

                txtVisaValidTill.Text = Convert.ToDateTime(dt.Rows[0]["VisaValidTill"].ToString()).ToShortDateString();
                txtIDNo.Text          = dt.Rows[0]["IDNo"].ToString();
                txtIDValidFrom.Text   = Convert.ToDateTime(dt.Rows[0]["IDValidFrom"].ToString()).ToShortDateString();
                txtIdValidTill.Text   = Convert.ToDateTime(dt.Rows[0]["IDValidTill"].ToString()).ToShortDateString();

                txtSocialSecurityNo.Text = dt.Rows[0]["SocialSecurityNo"].ToString();
                txtBankName.Text         = dt.Rows[0]["BankName"].ToString();
                txtBankBranch.Text       = dt.Rows[0]["BankBranch"].ToString();
                txtBankAccountNo.Text    = dt.Rows[0]["BankAccountNo"].ToString();

                txtIBANNo.Text           = dt.Rows[0]["IBANNo"].ToString();
                txtPersonalCodeVISA.Text = dt.Rows[0]["PersonalCode(VISA)"].ToString();
                txtBankCode.Text         = dt.Rows[0]["BankCode"].ToString();
                txtAirportName.Text      = dt.Rows[0]["AirportName"].ToString();

                txtDestinationCity.Text = dt.Rows[0]["DestinationCity"].ToString();
                txtEmployerId.Text      = dt.Rows[0]["EmployerId"].ToString();

                string strIsLocal = dt.Rows[0]["IsLocal"].ToString();
                // CblIsLocal.SelectedItem.Value = (strIsLocal == "True")?"1":"0";
                //CblIsLocal.
                txtGosiAmount.Text   = dt.Rows[0]["GOSIAmount"].ToString();
                ddlWorkLocation.Text = dt.Rows[0]["WorkLocation"].ToString();
            }
        }
예제 #8
0
        /// <summary>
        /// BindEmpId
        /// </summary>
        private void BindEmpId()
        {
            EmpBL     objEmp = new EmpBL();
            DataTable dt     = objEmp.GetAllEmployeeInfo();

            ddlEmpId.DataSource     = dt;
            ddlEmpId.DataMember     = "EmpId";
            ddlEmpId.DataValueField = "EmpId";
            ddlEmpId.DataBind();
        }
예제 #9
0
        /// <summary>
        /// GetStore
        /// </summary>
        private void GetStore()
        {
            EmpBL     objEmp = new EmpBL();
            DataTable dt     = objEmp.GetStore();

            ddlLocation.DataSource    = dt;
            ddlLocation.DataMember    = "LocationCode";
            ddlLocation.DataTextField = "LocationCode";
            ddlLocation.DataBind();
        }
예제 #10
0
        /// <summary>
        /// BindScheduleData
        /// </summary>
        private void BindScheduleData()
        {
            EmpBL ObjEmp = new EmpBL();

            // ObjEmp.FromDate = Convert.ToDateTime(txtFromDate.Text);
            //ObjEmp.ToDate = Convert.ToDateTime(txtToDate.Text);
            //ObjEmp.WorkLocation = Session["Location"].ToString();
            ObjEmp.WorkLocation = Session["Location"].ToString();

            DataTable dt = ObjEmp.GetScheduleImportData();

            gdvSchedule.DataSource = dt;
            gdvSchedule.DataBind();
        }
예제 #11
0
        /// <summary>
        /// setDefaultDates
        /// </summary>
        private void setDefaultDates()
        {
            EmpBL empObj = new EmpBL();

            DataTable dt = empObj.GetServerDate();

            if (dt.Rows.Count > 0)
            {
                txtFromDate.Text    = Convert.ToDateTime(dt.Rows[0]["FromDate"]).ToString("dd/MMM/yy");
                txtToDate.Text      = Convert.ToDateTime(dt.Rows[0]["ToDate"]).ToString("dd/MMM/yy");
                txtFromDate.Enabled = false;
                txtToDate.Enabled   = false;
            }
        }
예제 #12
0
        /// <summary>
        /// cmbEmpId_SelectedIndexChanged
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void cmbEmpId_SelectedIndexChanged(object sender, EventArgs e)
        {
            EmpBL objEmp = new EmpBL();

            objEmp.EmpId = cmbEmpId.Text;
            DataTable dt = objEmp.GetEmpDetailsById();

            GetStore();
            lblMessage.Text = "";

            if (dt.Rows.Count > 0)
            {
                txtName.Text      = dt.Rows[0]["Name"].ToString();
                ChkStatus.Checked = Convert.ToBoolean(dt.Rows[0]["Status"].ToString());
                ddlLocation.Text  = dt.Rows[0]["Location"].ToString();
            }
        }
예제 #13
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                EmpBL objEmp = new EmpBL();
                objEmp.EmpId    = txtUsername.Text.Trim();
                objEmp.Password = txtPassword.Text.Trim();
                DataTable dt = objEmp.GetLogin();

                lblMessage.Text      = objEmp.ExceptionMessage;
                lblMessage.ForeColor = System.Drawing.Color.Red;

                if (dt.Rows.Count > 0)
                {
                    Session["UserName"]  = dt.Rows[0]["EmpId"].ToString();
                    Session["Privilege"] = dt.Rows[0]["Privilege"].ToString();
                    Session["Location"]  = dt.Rows[0]["Location"].ToString();
                    Session["Name"]      = dt.Rows[0]["Name"].ToString();

                    if (dt.Rows[0]["Privilege"].ToString() == "L3")
                    {
                        Response.Redirect("~/Offer.aspx");
                    }
                    else
                    {
                        Response.Redirect("~/Attendance.aspx");
                    }
                }
                else
                {
                    //Session["UserName"] = "******";
                    //Response.Redirect("~/Attendance.aspx");
                    //lblMessage.Text = objEmp.ExceptionMessage;
                    //lblMessage.ForeColor = System.Drawing.Color.Red;
                }
            }
            catch (Exception ex)
            {
                lblMessage.Text      = ex.ToString();
                lblMessage.ForeColor = System.Drawing.Color.Red;
            }
        }
예제 #14
0
        /// <summary>
        /// btnUpdate_Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            EmpBL objEmp = new EmpBL();

            objEmp.StoreLocation = ddlLocation.Text;
            objEmp.EmpId         = cmbEmpId.Text;
            objEmp.EmpStatus     = ChkStatus.Checked;
            bool Result = objEmp.UpdateEmployeeInfo();

            if (Result)
            {
                lblMessage.Text      = "Successfully Updated";
                lblMessage.ForeColor = System.Drawing.Color.Green;
            }
            else
            {
                lblMessage.Text      = "Failed!";
                lblMessage.ForeColor = System.Drawing.Color.Red;
            }
        }
예제 #15
0
        /// <summary>
        /// btnUseCode_Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnUseCode_Click(object sender, EventArgs e)
        {
            EmpBL ObjEmp = new EmpBL();

            ObjEmp.MobileNo      = Convert.ToDecimal(txtMobileNo.Text.Trim());
            ObjEmp.OfferCode     = txtOfferCode.Text.Trim();
            ObjEmp.StoreLocation = Session["Location"].ToString();
            bool Result = ObjEmp.UpdateOffer();

            if (Result)
            {
                lblMessage.Text      = "Successfully Updated!";
                lblMessage.ForeColor = Color.Green;
                btnUseCode.Visible   = false;
            }
            else
            {
                lblMessage.Text      = "Faild";
                txtOfferCode.Text    = "";
                btnUseCode.Visible   = false;
                lblMessage.ForeColor = Color.Red;
            }
        }
예제 #16
0
        /// <summary>
        /// btnValidate_Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnValidate_Click(object sender, EventArgs e)
        {
            EmpBL ObjEmp = new EmpBL();

            ObjEmp.MobileNo = Convert.ToDecimal(txtMobileNo.Text.Trim());
            DataTable dt = ObjEmp.GetOfferCode();

            if (dt.Rows.Count > 0)
            {
                txtOfferCode.Text = dt.Rows[0]["Code"].ToString();

                lblMessage.Text      = "Valid Offer Code Available";
                lblMessage.ForeColor = Color.Green;
                btnUseCode.Visible   = true;
            }
            else
            {
                lblMessage.Text      = "No Valid Offer Code Available";
                txtOfferCode.Text    = "";
                btnUseCode.Visible   = false;
                lblMessage.ForeColor = Color.Red;
            }
        }
예제 #17
0
        /// <summary>
        /// BindData
        /// </summary>
        private void BindData()
        {
            if (txtFromDate.Text.Length > 0 && txtToDate.Text.Length > 0)
            {
                EmpBL objEmp = new EmpBL();
                objEmp.FromDate     = DateTime.ParseExact(txtFromDate.Text.Trim().ToString(), "dd/MMM/yy", CultureInfo.InvariantCulture);
                objEmp.ToDate       = DateTime.ParseExact(txtToDate.Text.Trim().ToString(), "dd/MMM/yy", CultureInfo.InvariantCulture);
                objEmp.WorkLocation = Session["Location"].ToString();
                DataTable dt = null;

                if (Session["Privilege"].ToString() == "L2")
                {
                    dt = objEmp.GetAttendanceLine();
                }
                else
                {
                    objEmp.EmpId = "All";
                    dt           = objEmp.GetAttendance();
                }
                gdvAttendance.DataSource = dt;
                gdvAttendance.DataBind();
                btnSave.Visible = true;
            }
        }
예제 #18
0
        public void TestEmpDepts()
        {
            var empBL = new EmpBL();

            Assert.AreNotEqual(null, _employee.GetDeptsAtBL());
        }
예제 #19
0
        /// <summary>
        /// Export Attendance
        /// </summary>
        private void ExportAttendance()
        {
            try
            {
                Excel1.Application myExcelApp;

                Excel1.Workbooks myExcelWorkbooks;

                Excel1.Workbook myExcelWorkbook;


                object misValue = System.Reflection.Missing.Value;

                myExcelApp = new Excel1.Application();

                myExcelApp.Visible = false;

                myExcelWorkbooks = myExcelApp.Workbooks;

                string fileName = HttpContext.Current.Server.MapPath(".") + "\\Templates\\AttendanceExport.xlsx";

                myExcelWorkbook = myExcelWorkbooks.Open(fileName, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue, misValue);
                Excel1.Worksheet xlSheet = (Excel1.Worksheet)myExcelWorkbook.Sheets[1];

                EmpBL objEmp = new EmpBL();
                objEmp.Date         = DateTime.ParseExact(txtDate.Text.Trim().ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture);
                objEmp.WorkLocation = Session["Location"].ToString();
                objEmp.ReportType   = rblType.SelectedItem.Value;
                DataTable dtEmp = objEmp.GetAttendanceLineByDate();

                if (dtEmp.Rows.Count > 0)
                {
                    WriteToExcelAttendance(dtEmp, xlSheet);
                    // ExportToPdf(dtEmp);
                    string Password = "******";

                    xlSheet.Protect(Password, misValue, misValue, misValue, misValue, misValue,
                                    misValue, misValue, misValue, misValue, misValue, misValue, misValue,
                                    misValue, misValue, misValue);

                    Random rnd      = new Random();
                    string filePath = Server.MapPath(".") + "\\Reports\\Attendance_" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + "_" + rnd.Next() + ".xlsx";
                    ViewState["FileNameAtt"] = filePath;
                    myExcelWorkbook.SaveAs(@filePath);

                    myExcelWorkbook.Close();
                    myExcelWorkbooks.Close();
                    btnDownload.Visible  = true;
                    lblMessage.Text      = "Successfully Exported";
                    lblMessage.ForeColor = System.Drawing.Color.Green;
                }
                else
                {
                    lblMessage.Text = "No Data Found";
                }
            }
            catch (Exception ex)
            {
                lblMessage.Text = ex.ToString();
            }
        }
예제 #20
0
        /// <summary>
        /// btnSave_Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();
            DataRow   dr;

            dt.Columns.Add(new System.Data.DataColumn("EmpId", typeof(String)));
            dt.Columns.Add(new System.Data.DataColumn("ShiftId", typeof(String)));
            dt.Columns.Add(new System.Data.DataColumn("Date", typeof(String)));
            dt.Columns.Add(new System.Data.DataColumn("Location", typeof(String)));
            bool flag = false;

            foreach (GridViewRow row in gdvSchedule.Rows)
            {
                Label EmpId = (Label)row.FindControl("Label1");
                //Label Date = (Label)row.FindControl("Label4");

                DateTime Date = DateTime.ParseExact(txtFromDate.Text.Trim().ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture);//Convert.ToDateTime(txtFromDate.Text);

                for (int i = 0; i < gdvSchedule.Columns.Count - 2; i++)
                {
                    DropDownList ShiftId = (DropDownList)row.FindControl("ddlShiftId" + (i + 1));
                    dr    = dt.NewRow();
                    dr[0] = EmpId.Text;
                    dr[1] = ShiftId.SelectedItem.Value;
                    dr[2] = Date.AddDays(i);
                    dr[3] = Session["Location"].ToString();

                    if (ShiftId.SelectedItem.Value == "0")
                    {
                        // row.Cells[i].BackColor = System.Drawing.Color.Red;
                        ShiftId.BackColor = System.Drawing.Color.Red;
                        flag = true;
                    }
                    else
                    {
                        //row.Cells[i].BackColor = System.Drawing.Color.White;
                        ShiftId.BackColor = System.Drawing.Color.White;
                    }
                    dt.Rows.Add(dr);
                }
            }

            if (!flag)
            {
                EmpBL ObjEmp = new EmpBL();
                ObjEmp.DtSource = dt;
                bool Result = ObjEmp.SaveSchedule();

                if (Result)
                {
                    lblMessage.Text      = "Successfully Saved";
                    lblMessage.ForeColor = System.Drawing.Color.Green;

                    string script = "alert(\"Successfully Saved!\");";
                    ScriptManager.RegisterStartupScript(this, GetType(),
                                                        "ServerControlScript", script, true);
                    btnSave.Visible = false;
                }
                else
                {
                    btnSave.Visible      = true;
                    lblMessage.Text      = "Failed !!!";
                    lblMessage.ForeColor = System.Drawing.Color.Red;
                }
            }
            else
            {
                lblMessage.Text      = "Please Put Proper Shift Id";
                lblMessage.ForeColor = System.Drawing.Color.Red;
            }
        }
예제 #21
0
        /// <summary>
        /// InsertEmpInfo
        /// </summary>
        private void InsertEmpInfo()
        {
            EmpBL objEmp = new EmpBL();

            objEmp.EmpId      = ddlEmpId.SelectedItem.Value;
            objEmp.FirstName  = txtFirstName.Text.Trim();
            objEmp.MiddleName = txtMiddleName.Text.Trim();
            objEmp.LastName   = txtLastName.Text.Trim();

            objEmp.DOB              = DateTime.ParseExact(txtDOB.Text.Trim().ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture);
            objEmp.Gender           = ddlGender.SelectedItem.Value;
            objEmp.PresentAddress   = txtPresentAddress.Text.Trim();
            objEmp.PermanentAddress = txtPermanentAddress.Text.Trim();

            objEmp.JoiningDate   = DateTime.ParseExact(txtJoiningDate.Text.Trim().ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture);;
            objEmp.MaritalStatus = ddlMaritalStatus.SelectedItem.Value;
            objEmp.Nationality   = txtNationality.Text.Trim();
            objEmp.EmpStatus     = true;

            objEmp.Phone1           = txtPhoneNo.Text.Trim();
            objEmp.PhoneHomeCountry = txtPhoneHome.Text.Trim();
            objEmp.Email            = txtEmail.Text.Trim();
            objEmp.WorkLocation     = ddlWorkLocation.SelectedItem.Value;

            objEmp.Designation       = ddlDesignation.SelectedItem.Text;
            objEmp.PassportNo        = txtPassportNo.Text.Trim();
            objEmp.PassportValidFrom = DateTime.ParseExact(txtPassportValidFrom.Text.Trim().ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture);
            objEmp.PassportValidTill = DateTime.ParseExact(txtPassportValidTill.Text.Trim().ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture);

            objEmp.VisaNo        = txtVisaNo.Text;
            objEmp.VisaType      = txtVisaType.Text;
            objEmp.VisaValidFrom = DateTime.ParseExact(txtVisaValidFrom.Text.Trim().ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture);
            objEmp.VisaValidTill = DateTime.ParseExact(txtVisaValidTill.Text.Trim().ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture);

            objEmp.IDNo             = txtIDNo.Text.Trim();
            objEmp.IDValidFrom      = DateTime.ParseExact(txtIDValidFrom.Text.Trim().ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture);
            objEmp.IDValidTill      = DateTime.ParseExact(txtIdValidTill.Text.Trim().ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture);
            objEmp.SocialSecurityNo = txtSocialSecurityNo.Text.Trim();

            objEmp.BankName      = txtBankName.Text.Trim();
            objEmp.BankBranch    = txtBankBranch.Text.Trim();
            objEmp.BankAccountNo = txtBankAccountNo.Text.Trim();
            objEmp.IBANNo        = txtIBANNo.Text.Trim();

            objEmp.PersonalCodeVISA = txtPersonalCodeVISA.Text.Trim();
            objEmp.BankCode         = txtBankCode.Text.Trim();
            objEmp.AirportName      = txtAirportName.Text.Trim();
            objEmp.DestinationCity  = txtDestinationCity.Text.Trim();

            objEmp.EmployerId = txtEmployerId.Text.Trim();
            objEmp.GosiAmount = Convert.ToDecimal(txtGosiAmount.Text.Trim());
            objEmp.IsLocal    = (CblIsLocal.SelectedItem.Text == "Yes"?true:false);

            bool Result = objEmp.InsertEmployeeInfo();

            if (Result)
            {
                lblMessage.Text      = "Successfully Added!";
                lblMessage.ForeColor = System.Drawing.Color.Green;
            }
            else
            {
                lblMessage.Text      = "Failed!";
                lblMessage.ForeColor = System.Drawing.Color.Red;
            }
        }
예제 #22
0
        /// <summary>
        /// btnSave_Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();
            DataRow   dr;

            dt.Columns.Add(new System.Data.DataColumn("Id", typeof(int)));
            dt.Columns.Add(new System.Data.DataColumn("Date", typeof(DateTime)));
            dt.Columns.Add(new System.Data.DataColumn("EmpId", typeof(String)));
            dt.Columns.Add(new System.Data.DataColumn("EmpName", typeof(String)));
            dt.Columns.Add(new System.Data.DataColumn("CheckIn", typeof(String)));

            dt.Columns.Add(new System.Data.DataColumn("CheckOut", typeof(String)));
            dt.Columns.Add(new System.Data.DataColumn("WorkedTime", typeof(String)));
            dt.Columns.Add(new System.Data.DataColumn("ShiftId", typeof(String)));
            dt.Columns.Add(new System.Data.DataColumn("SchIn", typeof(String)));

            dt.Columns.Add(new System.Data.DataColumn("SchOut", typeof(String)));
            dt.Columns.Add(new System.Data.DataColumn("BreakOut", typeof(String)));
            dt.Columns.Add(new System.Data.DataColumn("BreakIn", typeof(String)));
            dt.Columns.Add(new System.Data.DataColumn("BreakTime", typeof(String)));

            dt.Columns.Add(new System.Data.DataColumn("UnderTime", typeof(int)));
            dt.Columns.Add(new System.Data.DataColumn("UTAdj", typeof(int)));
            dt.Columns.Add(new System.Data.DataColumn("OwedHours", typeof(int)));
            dt.Columns.Add(new System.Data.DataColumn("OHAdj", typeof(int)));

            dt.Columns.Add(new System.Data.DataColumn("SystemRemarks", typeof(String)));
            dt.Columns.Add(new System.Data.DataColumn("L1Remarks", typeof(String)));
            dt.Columns.Add(new System.Data.DataColumn("L1Approve", typeof(bool)));
            dt.Columns.Add(new System.Data.DataColumn("L2Remarks", typeof(String)));

            dt.Columns.Add(new System.Data.DataColumn("L2Approve", typeof(bool)));
            dt.Columns.Add(new System.Data.DataColumn("StoreLocation", typeof(String)));
            bool flag = false;

            foreach (GridViewRow row in gdvAttendance.Rows)
            {
                Label Id      = (Label)row.FindControl("Id");
                Label Date    = (Label)row.FindControl("txtDate");
                Label EmpId   = (Label)row.FindControl("lblEmpId");
                Label EmpName = (Label)row.FindControl("lblEmpName");
                Label CheckIn = (Label)row.FindControl("lblCheckIn");

                Label CheckOut   = (Label)row.FindControl("lblCheckOut");
                Label WorkedTime = (Label)row.FindControl("lblWorkedTime");

                Label ShiftId = (Label)row.FindControl("lblShiftId");
                Label SchIn   = (Label)row.FindControl("lblSchIn");
                Label SchOut  = (Label)row.FindControl("lblSchOut");

                Label BreakOut  = (Label)row.FindControl("lblBreakOut");
                Label BreakIn   = (Label)row.FindControl("lblBreakIn");
                Label BreakTime = (Label)row.FindControl("lblBreakTime");
                Label UnderTime = (Label)row.FindControl("lblUnderTime");

                TextBox txtUnderTimeAdj = (TextBox)row.FindControl("txtUnderTimeAdj");
                Label   OverTime        = (Label)row.FindControl("lblOverTime");
                TextBox OwedHoursAdj    = (TextBox)row.FindControl("txtOwedHoursAdj");
                Label   SystemRemarks   = (Label)row.FindControl("lblSystemRemarks");

                DropDownList ddlL1Remarks = (DropDownList)row.FindControl("ddlL1Remarks");
                CheckBox     Level1       = (CheckBox)row.FindControl("chkLevel1");
                TextBox      txtL2Remarks = (TextBox)row.FindControl("txtL2Remarks");
                CheckBox     chkLevel2    = (CheckBox)row.FindControl("chkLevel2");



                dr = dt.NewRow();

                dr[0] = Id.Text;
                dr[1] = Date.Text;
                dr[2] = EmpId.Text;
                dr[3] = EmpName.Text;

                dr[4] = CheckIn.Text;
                dr[5] = CheckOut.Text;

                dr[6] = WorkedTime.Text;
                dr[7] = ShiftId.Text;
                dr[8] = SchIn.Text;

                dr[9]  = SchOut.Text;
                dr[10] = BreakOut.Text;
                dr[11] = BreakIn.Text;
                dr[12] = BreakTime.Text;

                dr[13] = UnderTime.Text;
                dr[14] = txtUnderTimeAdj.Text;
                dr[15] = OverTime.Text;
                dr[16] = OwedHoursAdj.Text;

                dr[17] = SystemRemarks.Text;
                dr[18] = ddlL1Remarks.SelectedItem.Value;
                dr[19] = Level1.Checked;
                dr[20] = txtL2Remarks.Text;

                dr[21] = chkLevel2.Checked;
                dr[22] = Session["Location"].ToString();


                if (Level1.Checked)
                {
                    dt.Rows.Add(dr);
                }

                //if (ShiftId.SelectedItem.Value == "0")
                //{
                //    // row.Cells[i].BackColor = System.Drawing.Color.Red;
                //    ShiftId.BackColor = System.Drawing.Color.Red;
                //    flag = true;
                //}
            }

            if (!flag)
            {
                EmpBL ObjEmp = new EmpBL();
                ObjEmp.DtSource = dt;

                bool Result = false;

                if (Session["Privilege"].ToString() == "L1")
                {
                    Result = ObjEmp.SaveAttendance();
                }
                else
                {
                    dt.Columns.Remove("Date");
                    dt.Columns.Remove("EmpName");
                    dt.Columns.Remove("CheckIn");
                    dt.Columns.Remove("CheckOut");

                    dt.Columns.Remove("WorkedTime");
                    dt.Columns.Remove("ShiftId");
                    dt.Columns.Remove("SchIn");
                    dt.Columns.Remove("SchOut");

                    dt.Columns.Remove("BreakOut");
                    dt.Columns.Remove("BreakIn");
                    dt.Columns.Remove("BreakTime");
                    dt.Columns.Remove("UnderTime");

                    dt.Columns.Remove("UTAdj");
                    dt.Columns.Remove("OwedHours");
                    dt.Columns.Remove("OHAdj");
                    dt.Columns.Remove("SystemRemarks");

                    dt.Columns.Remove("L1Remarks");
                    dt.Columns.Remove("L1Approve");
                    dt.Columns.Remove("StoreLocation");

                    ObjEmp.DtSource = dt;


                    Result = ObjEmp.UpdateAttendanceLine();
                }

                if (Result)
                {
                    lblMessage.Text      = "Successfully Saved";
                    lblMessage.ForeColor = System.Drawing.Color.Green;

                    string script = "alert(\"Successfully Saved!\");";
                    ScriptManager.RegisterStartupScript(this, GetType(),
                                                        "ServerControlScript", script, true);
                    btnSave.Visible = false;
                    BindData();
                }
                else
                {
                    btnSave.Visible      = true;
                    lblMessage.Text      = "Failed !!!";
                    lblMessage.ForeColor = System.Drawing.Color.Red;
                }
            }
            else
            {
                lblMessage.Text      = "Please Put Proper Remarks";
                lblMessage.ForeColor = System.Drawing.Color.Red;
            }
        }