Exemplo n.º 1
0
 /// <summary>
 /// Function to add columns to Datagridview dynamically
 /// </summary>
 public void CreateGrid()
 {
     try
     {
         dgvMonthlyAttendance.Rows.Clear();
         dgvMonthlyAttendance.Columns.Clear();
         AttendanceBll BllAttendanceMaster = new AttendanceBll();
         int           inDays = DateTime.DaysInMonth(dtpMonth.Value.Year, dtpMonth.Value.Month);
         dgvMonthlyAttendance.Columns.Add("employeeId", "Employee Id");
         dgvMonthlyAttendance.Columns.Add("SlNo", "SlNO");
         dgvMonthlyAttendance.Columns.Add("employeeCode", "Employee Code");
         dgvMonthlyAttendance.Columns.Add("employeeName", "Employee Name");
         for (int i = 1; i <= inDays; ++i)
         {
             dgvMonthlyAttendance.Columns.Add(i.ToString(), i.ToString());
             DateTime dt = new DateTime(dtpMonth.Value.Year, dtpMonth.Value.Month, i);
         }
         dgvMonthlyAttendance.Columns.Add("Present", "Present");
         dgvMonthlyAttendance.Columns.Add("Absent", "Absent");
         dgvMonthlyAttendance.Columns["employeeId"].Visible = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show("MAR3 " + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// On 'Print' button click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnPrint_Click(object sender, EventArgs e)
 {
     try
     {
         if (dgvDailyAttendanceReport.RowCount > 0)
         {
             DataSet ds = new DataSet();
             //CompanySP spCompany = new CompanySP();
             CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
             List <DataTable>   listObjCompany     = bllCompanyCreation.CompanyViewDataTable(1);
             ds.Tables.Add(listObjCompany[0]);
             AttendanceBll    BllAttendanceMaster = new AttendanceBll();
             List <DataTable> ListAttendance      = BllAttendanceMaster.DailyAttendanceViewForDailyAttendanceReport(dtpDate.Text.Trim(), cmbStatus.Text.Trim(), cmbEmployee.Text.Trim(), cmbDesignation.Text.Trim());
             ds.Tables.Add(ListAttendance[0]);
             frmReport frmReportObj = new frmReport();
             frmReportObj.MdiParent = formMDI.MDIObj;
             frmReportObj.DailyAttendanceReportPrinting(ds);
         }
         else
         {
             Messages.InformationMessage("No data found");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("DAR:8" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 3
0
        protected void btnPost_Click(object sender, EventArgs e)
        {
            AttendanceBll aBll = new AttendanceBll();

            site = new DBSite();

            List <AttendanceBll.AttendanceEntity> attdList = new List <AttendanceBll.AttendanceEntity>();

            AttendanceBll.AttendanceEntity atd;

            foreach (GridViewRow gr in gridView1.Rows)
            {
                atd = new AttendanceBll.AttendanceEntity();

                CheckBox cb = (CheckBox)gr.Cells[0].FindControl("ckbPresent");
                if (cb.Checked)
                {
                    atd.Status = 1;
                }
                else
                {
                    atd.Status = 0;
                }

                atd.AttendanceId = util.CheckNullInt(gr.Cells[2].Text);

                attdList.Add(atd);
            }

            aBll.PostAttendance(site, attdList);
        }
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void GridFill()
 {
     try
     {
         DailyAttendanceDetailsInfo infoDailyAttendanceDetails = new DailyAttendanceDetailsInfo();
         AttendanceBll             BllAttandance             = new AttendanceBll();
         DailyAttendanceMasterInfo infoDailyAttendanceMaster = new DailyAttendanceMasterInfo();
         AttendanceBll             BllAttandanceMaster       = new AttendanceBll();
         string strDate = txtCompanyCurrentdate.Text;
         if (BllAttandanceMaster.DailyAttendanceMasterMasterIdSearch(strDate))
         {
             List <DataTable> listObj = new List <DataTable>();
             infoDailyAttendanceMaster.Date = Convert.ToDateTime(txtCompanyCurrentdate.Text.ToString());
             listObj = BllAttandance.DailyAttendanceDetailsSearchGridFill(txtCompanyCurrentdate.Text.ToString());
             dgvAttendance.DataSource = listObj[0];
             btnDelete.Enabled        = true;
             btnSave.Text             = "Update";
             int    inRowCount         = dgvAttendance.RowCount;
             string strMasterNarration = string.Empty;
             for (int i = 0; i < inRowCount; i++)
             {
                 if (dgvAttendance.Rows[i].Cells["MasterNarration"].Value.ToString() != "")
                 {
                     strMasterNarration = dgvAttendance.Rows[i].Cells["MasterNarration"].Value.ToString();
                 }
             }
             txtNarrationInMaster.Text = strMasterNarration;
         }
         else
         {
             List <DataTable> listObj1 = new List <DataTable>();
             listObj1 = BllAttandance.DailyAttendanceDetailsSearchGridFill(txtCompanyCurrentdate.Text.ToString());
             dgvAttendance.DataSource = listObj1[0];
             btnDelete.Enabled        = false;
             btnSave.Text             = "Save";
             int    inRowCount         = dgvAttendance.RowCount;
             string strMasterNarration = string.Empty;
             for (int i = 0; i < inRowCount; i++)
             {
                 if (dgvAttendance.Rows[i].Cells["MasterNarration"].Value.ToString() != null)
                 {
                     strMasterNarration = dgvAttendance.Rows[i].Cells["MasterNarration"].Value.ToString();
                 }
             }
             txtNarrationInMaster.Text = strMasterNarration;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("A1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void GridFill()
 {
     try
     {
         string strEmployeeStatus = string.Empty;
         if (rbtnAll.Checked)
         {
             strEmployeeStatus = "All";
         }
         else if (rbtnActive.Checked)
         {
             strEmployeeStatus = "Active";
         }
         else if (rbtnInActive.Checked)
         {
             strEmployeeStatus = "InActive";
         }
         if (strEmployeeStatus != string.Empty && cmbDesigantion.SelectedIndex > -1)
         {
             CreateGrid();
             AttendanceBll       BllAttendanceMaster = new AttendanceBll();
             EmployeeCreationBll BllEmployeeCreation = new EmployeeCreationBll();
             List <DataTable>    listEmployee        = new List <DataTable>();
             listEmployee = BllEmployeeCreation.EmployeeViewByDesignationAndStatus(cmbDesigantion.Text, strEmployeeStatus);
             if (listEmployee[0].Rows.Count > 0)
             {
                 for (int i = 0; i < listEmployee[0].Rows.Count; i++)
                 {
                     dgvMonthlyAttendance.Rows.Add();
                     dgvMonthlyAttendance.Rows[i].Cells["employeeId"].Value   = listEmployee[0].Rows[i]["employeeId"].ToString();
                     dgvMonthlyAttendance.Rows[i].Cells["SlNo"].Value         = i + 1;
                     dgvMonthlyAttendance.Rows[i].Cells["employeeName"].Value = listEmployee[0].Rows[i]["employeeName"].ToString();
                     dgvMonthlyAttendance.Rows[i].Cells["employeeCode"].Value = listEmployee[0].Rows[i]["employeeCode"].ToString();
                     List <DataTable> listStatus = BllAttendanceMaster.MonthlyAttendanceReportFill(dtpMonth.Value, Convert.ToDecimal(listEmployee[0].Rows[i]["employeeId"].ToString()));
                     if (listStatus[0].Rows.Count > 0)
                     {
                         for (int j = 0; j < listStatus[0].Rows.Count; j++)
                         {
                             dgvMonthlyAttendance.Rows[i].Cells[DateTime.Parse(listStatus[0].Rows[j]["date"].ToString()).Day.ToString()].Value = listStatus[0].Rows[j]["status"].ToString();
                         }
                     }
                     FindTotal(i);
                 }
             }
             CheckedChange();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("MAR2 " + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 public void GridFill()
 {
     try
     {
         List <DataTable> listObjDesignation  = new List <DataTable>();
         AttendanceBll    BllAttendanceMaster = new AttendanceBll();
         listObjDesignation = BllAttendanceMaster.DailyAttendanceViewForDailyAttendanceReport(dtpDate.Text.Trim(), cmbStatus.Text.Trim(), cmbEmployee.Text.Trim(), cmbDesignation.Text.Trim());
         dgvDailyAttendanceReport.DataSource = listObjDesignation[0];
         dgvDailyAttendanceReport.Columns["employeeId"].Visible = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show("DAR:4" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to Delete
 /// </summary>
 public void DeleteFunction()
 {
     try
     {
         AttendanceBll BllAttendance = new AttendanceBll();
         BllAttendance.DailyAttendanceDetailsDeleteAll(Convert.ToDecimal(dgvAttendance.CurrentRow.Cells["dgvtxtdailyAttendanceMasterId"].Value.ToString()));
         Messages.DeletedMessage();
         Clear();
         btnDelete.Enabled = false;
         btnSave.Text      = "Save";
     }
     catch (Exception ex)
     {
         MessageBox.Show("A5" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemplo n.º 8
0
        private void GetAttendance(bool onlyAbsentees)
        {
            site = new DBSite();
            AttendanceBll aBll = new AttendanceBll();

            aBll.ProcessMachineAttendance(site, int.Parse(ddlYear.SelectedValue), int.Parse(ddlMonth.SelectedValue), int.Parse(ddlDay.SelectedValue), 0);


            try
            {
                List <AttendanceBll.AttendanceEntity> attdlist = aBll.GetAttendance(site, int.Parse(ddlYear.SelectedValue), int.Parse(ddlMonth.SelectedValue), int.Parse(ddlDay.SelectedValue), int.Parse(ddlClass.SelectedValue), onlyAbsentees);
                total_records        = attdlist.Count;
                gridView1.DataSource = attdlist;
                gridView1.DataBind();
            }
            catch (Exception exception)
            {
                util.HandleExpception(exception, Response);
            }
            finally
            {
                site.Close();
            }
        }
        //Function to edit
        public void EditFunction()
        {
            try
            {
                decimal decResult = HolidaySettings();
                if (decResult != 1)
                {
                    DailyAttendanceDetailsInfo infoDailyAttendanceDetails = new DailyAttendanceDetailsInfo();
                    AttendanceBll             BllAttendance             = new AttendanceBll();
                    DailyAttendanceMasterInfo infoDailyAttendanceMaster = new DailyAttendanceMasterInfo();
                    AttendanceBll             BllAttendanceMaster       = new AttendanceBll();
                    infoDailyAttendanceMaster.Date      = DateTime.Parse(txtCompanyCurrentdate.Text.ToString());
                    infoDailyAttendanceMaster.Narration = txtNarrationInMaster.Text.Trim();
                    infoDailyAttendanceMaster.Extra1    = string.Empty;
                    infoDailyAttendanceMaster.Extra2    = string.Empty;
                    int inrowcount = dgvAttendance.RowCount;
                    for (int i = 0; i <= inrowcount - 1; i++)
                    {
                        if (dgvAttendance.Rows[i].Cells["dgvtxtdailyAttendanceMasterId"].Value.ToString() != "")
                        {
                            decMasterIdForEdit = Convert.ToDecimal(dgvAttendance.Rows[i].Cells["dgvtxtdailyAttendanceMasterId"].Value.ToString());   //storing Dailymasterid
                        }
                    }
                    infoDailyAttendanceMaster.DailyAttendanceMasterId = decMasterIdForEdit;
                    BllAttendanceMaster.DailyAttendanceEditMaster(infoDailyAttendanceMaster);
                    infoDailyAttendanceDetails.DailyAttendanceMasterId = decMasterIdForEdit;
                    for (int i = 0; i <= inrowcount - 1; i++)
                    {
                        if (dgvAttendance.Rows[i].Cells["dgvtxtDailyAttendanceDetailsId"].Value.ToString() != "")
                        {
                            // for updation of saved employees
                            if (dgvAttendance.Rows[i].Cells["dgvtxtColumnEmployeeId"].Value != null && dgvAttendance.Rows[i].Cells["dgvtxtColumnEmployeeId"].Value.ToString() != "")
                            {
                                infoDailyAttendanceDetails.EmployeeId = Convert.ToDecimal(dgvAttendance.Rows[i].Cells["dgvtxtColumnEmployeeId"].Value.ToString());
                            }
                            if (dgvAttendance.Rows[i].Cells["dgvtxtDailyAttendanceDetailsId"].Value != null && dgvAttendance.Rows[i].Cells["dgvtxtDailyAttendanceDetailsId"].Value.ToString() != "")
                            {
                                infoDailyAttendanceDetails.DailyAttendanceDetailsId = Convert.ToDecimal(dgvAttendance.Rows[i].Cells["dgvtxtDailyAttendanceDetailsId"].Value.ToString());
                            }
                            if (dgvAttendance.Rows[i].Cells["dgvtxtdailyAttendanceMasterId"].Value != null && dgvAttendance.Rows[i].Cells["dgvtxtdailyAttendanceMasterId"].Value.ToString() != "")
                            {
                                infoDailyAttendanceDetails.DailyAttendanceMasterId = Convert.ToDecimal(dgvAttendance.Rows[i].Cells["dgvtxtdailyAttendanceMasterId"].Value.ToString());
                            }
                            if (dgvAttendance.Rows[i].Cells["dgvcmbcolumnStatus"].Value != null &&
                                dgvAttendance.Rows[i].Cells["dgvcmbcolumnStatus"].Value.ToString() != "")
                            {
                                infoDailyAttendanceDetails.Status = dgvAttendance.Rows[i].Cells["dgvcmbcolumnStatus"].Value.ToString();
                            }
                            else
                            {
                                infoDailyAttendanceDetails.Status = "Present";
                            }
                            if (dgvAttendance.Rows[i].Cells["dgvtxtColumnnarration"].Value != null &&
                                dgvAttendance.Rows[i].Cells["dgvtxtColumnnarration"].Value.ToString() != "")
                            {
                                infoDailyAttendanceDetails.Narration = dgvAttendance.Rows[i].Cells["dgvtxtColumnnarration"].Value.ToString();
                            }
                            else
                            {
                                infoDailyAttendanceDetails.Narration = "";
                            }
                            infoDailyAttendanceDetails.Extra1 = string.Empty;
                            infoDailyAttendanceDetails.Extra2 = string.Empty;
                            BllAttendance.DailyAttendanceDetailsEditUsingMasterId(infoDailyAttendanceDetails);
                        }
                        else
                        {
                            // for new employees to add
                            if (dgvAttendance.Rows[i].Cells["dgvtxtColumnEmployeeId"].Value != null && dgvAttendance.Rows[i].Cells["dgvtxtColumnEmployeeId"].Value.ToString() != "")
                            {
                                infoDailyAttendanceDetails.EmployeeId = Convert.ToDecimal(dgvAttendance.Rows[i].Cells["dgvtxtColumnEmployeeId"].Value.ToString());
                            }
                            if (dgvAttendance.Rows[i].Cells["dgvcmbcolumnStatus"].Value != null &&
                                dgvAttendance.Rows[i].Cells["dgvcmbcolumnStatus"].Value.ToString() != "")
                            {
                                infoDailyAttendanceDetails.Status = dgvAttendance.Rows[i].Cells["dgvcmbcolumnStatus"].Value.ToString();
                            }
                            else
                            {
                                infoDailyAttendanceDetails.Status = "Present";
                            }
                            if (dgvAttendance.Rows[i].Cells["dgvtxtColumnnarration"].Value != null &&
                                dgvAttendance.Rows[i].Cells["dgvtxtColumnnarration"].Value.ToString() != "")
                            {
                                infoDailyAttendanceDetails.Narration = dgvAttendance.Rows[i].Cells["dgvtxtColumnnarration"].Value.ToString();
                            }
                            else
                            {
                                infoDailyAttendanceDetails.Narration = "";
                            }
                            infoDailyAttendanceDetails.Extra1 = string.Empty;
                            infoDailyAttendanceDetails.Extra2 = string.Empty;
                            infoDailyAttendanceDetails.DailyAttendanceMasterId = decMasterIdForEdit;
                            BllAttendance.DailyAttendanceDetailsAddUsingMasterId(infoDailyAttendanceDetails);
                        }
                    } //   updation of old employees & addition of new employees closes here
                    Messages.UpdatedMessage();
                    Clear();
                }
                else
                {
                    Messages.InformationMessage("Selected date is holiday");
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("A3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
        /// <summary>
        /// Function to save
        /// </summary>
        public void SaveFunction()
        {
            try
            {
                decimal decResult = HolidaySettings();
                if (decResult != 1)
                {
                    DailyAttendanceDetailsInfo infoDailyAttendanceDetails = new DailyAttendanceDetailsInfo();
                    AttendanceBll             BllAttendance             = new AttendanceBll();
                    DailyAttendanceMasterInfo infoDailyAttendanceMaster = new DailyAttendanceMasterInfo();
                    AttendanceBll             BllAttendanceMaster       = new AttendanceBll();
                    infoDailyAttendanceMaster.Date      = Convert.ToDateTime(txtCompanyCurrentdate.Text.ToString());
                    infoDailyAttendanceMaster.Narration = txtNarrationInMaster.Text.Trim();
                    infoDailyAttendanceMaster.Extra1    = string.Empty;
                    infoDailyAttendanceMaster.Extra2    = string.Empty;
                    int inrowcount = dgvAttendance.RowCount;
                    decMasterIdForEdit = BllAttendanceMaster.DailyAttendanceAddToMaster(infoDailyAttendanceMaster);  // calling @@identity
                    infoDailyAttendanceDetails.DailyAttendanceMasterId = decMasterIdForEdit;
                    for (int i = 0; i <= inrowcount - 1; i++)
                    {
                        if (dgvAttendance.Rows[i].Cells["dgvtxtColumnEmployeeId"].Value != null && dgvAttendance.Rows[i].Cells["dgvtxtColumnEmployeeId"].Value.ToString() != "")
                        {
                            infoDailyAttendanceDetails.EmployeeId = Convert.ToDecimal(dgvAttendance.Rows[i].Cells["dgvtxtColumnEmployeeId"].Value.ToString());
                        }
                        if (dgvAttendance.Rows[i].Cells["dgvcmbcolumnStatus"].Value != null &&
                            dgvAttendance.Rows[i].Cells["dgvcmbcolumnStatus"].Value.ToString() != "")
                        {
                            infoDailyAttendanceDetails.Status = dgvAttendance.Rows[i].Cells["dgvcmbcolumnStatus"].Value.ToString();
                        }
                        else
                        {
                            infoDailyAttendanceDetails.Status = "Present";
                        }
                        if (dgvAttendance.Rows[i].Cells["dgvtxtColumnnarration"].Value != null &&
                            dgvAttendance.Rows[i].Cells["dgvtxtColumnnarration"].Value.ToString() != "")
                        {
                            infoDailyAttendanceDetails.Narration = dgvAttendance.Rows[i].Cells["dgvtxtColumnnarration"].Value.ToString();
                        }
                        else
                        {
                            infoDailyAttendanceDetails.Narration = "";
                        }
                        infoDailyAttendanceDetails.Extra1 = string.Empty;
                        infoDailyAttendanceDetails.Extra2 = string.Empty;
                        infoDailyAttendanceDetails.DailyAttendanceMasterId = decMasterIdForEdit;
                        BllAttendance.DailyAttendanceDetailsAddUsingMasterId(infoDailyAttendanceDetails);
                    }
                    Messages.SavedMessage();
                    Clear();
                }
                else
                {
                    Messages.InformationMessage("Selected date is holiday");
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("A2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 11
0
        protected void btnSendSMSToAbsentees_Click(object sender, EventArgs e)
        {
            Util_BLL      util = new Util_BLL();
            AttendanceBll abll = new AttendanceBll();

            site = new DBSite();
            List <AttendanceBll.AttendanceEntity> attdList = new List <AttendanceBll.AttendanceEntity>();

            AttendanceBll.AttendanceEntity atd;

            foreach (GridViewRow gr in gridView1.Rows)
            {
                atd = new AttendanceBll.AttendanceEntity();



                CheckBox cb = (CheckBox)gr.Cells[0].FindControl("ckbPresent");
                if (!cb.Checked)
                {
                    atd.AttendanceId = util.CheckNullInt(gr.Cells[2].Text);

                    string msg = "Dear Parent, Your Child Name <40> is absent today.";
                    msg = msg.Replace("<40>", util.CheckNull(gr.Cells[3].Text));

                    // 5cs School, Lalpur
                    if (Util_BLL.User.SenderId == "FifthC")
                    {
                        msg = "Dear Parents, Your ward '<40>' is absent today from School.";
                        msg = msg.Replace("<40>", util.CheckNull(gr.Cells[3].Text));
                    }


                    // if not class is Staff then do not send sms
                    // and not sms has been sent already

                    string mobileNo = abll.GetMobileNo(site, atd.AttendanceId);

                    string ss = util.SendSms(site, mobileNo, msg, Util_BLL.User, this.Response, false);

                    int sms_count = 0;

                    try
                    {
                        site.BeginTrans();

                        sms_count = util.SaveSentSMSToDB(site, mobileNo, msg, false, Util_BLL.User);
                        site.Commit();
                    }
                    catch (Exception ex)
                    {
                        site.RollBack();
                    }



                    if (abll.GetClassName(site, atd.AttendanceId).ToUpper() != "STAFF" && !abll.IsSMSSent(site, atd.AttendanceId))
                    {
                        //string ss = util.SendSms(abll.GetMobileNo(site, atd.AttendanceId), msg, Util_BLL.User, this.Response);
                    }


                    attdList.Add(atd);
                }
            }

            abll.PostSMS(site, attdList);
        }