コード例 #1
0
 public void DailyAttendanceDetailsEditUsingMasterId(DailyAttendanceDetailsInfo dailyattendancedetailsinfo)
 {
     try
     {
         SpDailyAttendanceDetails.DailyAttendanceDetailsEditUsingMasterId(dailyattendancedetailsinfo);
     }
     catch (Exception ex)
     {
         MessageBox.Show("A3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #2
0
        //Function to edit
        public void EditFunction()
        {
            try
            {
                decimal decResult = HolidaySettings();
                if (decResult != 1)
                {
                    DailyAttendanceDetailsInfo infoDailyAttendanceDetails = new DailyAttendanceDetailsInfo();
                    DailyAttendanceDetailsSP   spDailyAttendanceDetails   = new DailyAttendanceDetailsSP();
                    DailyAttendanceMasterInfo  infoDailyAttendanceMaster  = new DailyAttendanceMasterInfo();
                    DailyAttendanceMasterSP    spDailyAttendanceMaster    = new DailyAttendanceMasterSP();
                    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;
                    spDailyAttendanceMaster.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;
                            spDailyAttendanceDetails.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;
                            spDailyAttendanceDetails.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);
            }
        }
コード例 #3
0
        public bool EditFunction(string date, string tableData)
        {
            try
            {
                List <Dictionary <string, object> > items = JsonConvert.DeserializeObject <List <Dictionary <string, object> > >(tableData);

                DailyAttendanceDetailsInfo infoDailyAttendanceDetails = new DailyAttendanceDetailsInfo();
                DailyAttendanceDetailsSP   spDailyAttendanceDetails   = new DailyAttendanceDetailsSP();
                DailyAttendanceMasterInfo  infoDailyAttendanceMaster  = new DailyAttendanceMasterInfo();
                DailyAttendanceMasterSP    spDailyAttendanceMaster    = new DailyAttendanceMasterSP();
                infoDailyAttendanceMaster.Date      = Convert.ToDateTime(date);
                infoDailyAttendanceMaster.Narration = string.Empty;
                infoDailyAttendanceMaster.Extra1    = string.Empty;
                infoDailyAttendanceMaster.Extra2    = string.Empty;
                decimal decMasterIdForEdit = 0;
                int     inrowcount         = items.Count;
                for (int i = 0; i < inrowcount; i++)
                {
                    string masterId = items[i]["masterId"].ToString() ?? string.Empty;
                    if (masterId != "")
                    {
                        decMasterIdForEdit = Convert.ToDecimal(masterId);   //storing Dailymasterid
                    }
                }
                infoDailyAttendanceMaster.DailyAttendanceMasterId = decMasterIdForEdit;
                spDailyAttendanceMaster.DailyAttendanceEditMaster(infoDailyAttendanceMaster);
                infoDailyAttendanceDetails.DailyAttendanceMasterId = decMasterIdForEdit;
                for (int i = 0; i < inrowcount; i++)
                {
                    string detailsId  = items[i]["detailsId"].ToString() ?? string.Empty;
                    string masterId   = items[i]["masterId"].ToString() ?? string.Empty;
                    string employeeId = items[i]["employeeId"].ToString() ?? string.Empty;
                    string status     = items[i]["status"].ToString() ?? string.Empty;
                    string narration  = items[i]["narration"].ToString() ?? string.Empty;
                    narration = narration.Replace("\n", "\\n");

                    if (detailsId != "")
                    {
                        // for updation of saved employees
                        if (employeeId != null && employeeId != "")
                        {
                            infoDailyAttendanceDetails.EmployeeId = Convert.ToDecimal(employeeId);
                        }
                        if (detailsId != null && detailsId != "")
                        {
                            infoDailyAttendanceDetails.DailyAttendanceDetailsId = Convert.ToDecimal(detailsId);
                        }
                        if (masterId != null && masterId != "")
                        {
                            infoDailyAttendanceDetails.DailyAttendanceMasterId = Convert.ToDecimal(masterId);
                        }
                        if (status != null && status != "")
                        {
                            infoDailyAttendanceDetails.Status = status;
                        }
                        else
                        {
                            infoDailyAttendanceDetails.Status = "Present";
                        }
                        if (narration != null && narration != "")
                        {
                            infoDailyAttendanceDetails.Narration = narration;
                        }
                        else
                        {
                            infoDailyAttendanceDetails.Narration = "";
                        }
                        infoDailyAttendanceDetails.Extra1 = string.Empty;
                        infoDailyAttendanceDetails.Extra2 = string.Empty;
                        spDailyAttendanceDetails.DailyAttendanceDetailsEditUsingMasterId(infoDailyAttendanceDetails);
                    }
                    else
                    {
                        // for new employees to add
                        if (employeeId != null && employeeId != "")
                        {
                            infoDailyAttendanceDetails.EmployeeId = Convert.ToDecimal(employeeId);
                        }
                        if (status != null && status != "")
                        {
                            infoDailyAttendanceDetails.Status = status;
                        }
                        else
                        {
                            infoDailyAttendanceDetails.Status = "Present";
                        }
                        if (narration != null && narration != "")
                        {
                            infoDailyAttendanceDetails.Narration = narration;
                        }
                        else
                        {
                            infoDailyAttendanceDetails.Narration = "";
                        }
                        infoDailyAttendanceDetails.Extra1 = string.Empty;
                        infoDailyAttendanceDetails.Extra2 = string.Empty;
                        infoDailyAttendanceDetails.DailyAttendanceMasterId = decMasterIdForEdit;
                        spDailyAttendanceDetails.DailyAttendanceDetailsAddUsingMasterId(infoDailyAttendanceDetails);
                    }
                } //   updation of old employees & addition of new employees closes here
            }
            catch (Exception ex)
            {
                return(false);
            }
            return(true);
        }