예제 #1
0
 /// <summary>
 /// Function to Update values in Holiday Table
 /// </summary>
 /// <param name="holidayinfo"></param>
 public void HolidayEdit(HolidayInfo holidayinfo)
 {
     try
     {
         SPHoliday.HolidayEdit(holidayinfo);
     }
     catch (Exception ex)
     {
         MessageBox.Show("HSBll2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        public JsonResult EditHoliday(string date, string narration)
        {
            HolidaySP spHoliday = new HolidaySP();

            try
            {
                HolidayInfo infoHoliday = new HolidayInfo();
                {
                    DateTime curdate  = Convert.ToDateTime(date);
                    string   strMonth = curdate.ToString("MMMMyyyydd");
                    string   dtpMonth = strMonth.Substring(0, 3);

                    string  dtpYear = curdate.Year.ToString();
                    string  dtpDay  = strMonth.Substring(strMonth.Length - 2, 2);
                    decimal id      = spHoliday.HolidaySettingsSearchByDate(dtpMonth, dtpYear, dtpDay).HolidayId;

                    infoHoliday.HolidayId = id;
                    infoHoliday.Date      = curdate;
                    if (narration != null)
                    {
                        infoHoliday.Narration = narration.Trim();
                    }
                    else
                    {
                        infoHoliday.Narration = string.Empty;
                    }
                    infoHoliday.HolidayName = string.Empty;
                    infoHoliday.ExtraDate   = DateTime.Now;
                    infoHoliday.Extra1      = string.Empty;
                    infoHoliday.Extra2      = string.Empty;
                    spHoliday.HolidayEdit(infoHoliday);
                }
                HolidaySettingsDate(date);
            }

            catch (Exception ex)
            {
                return(Json(new { error = "failed" }));
            }
            return(Json(new { error = "success" }));
        }