コード例 #1
0
ファイル: UCClosedDays.cs プロジェクト: 5509850/baumax
        YearlyWorkingDay GetEntityByRowHandle(int rowHandle)
        {
            YearlyWorkingDay WorkingDay = null;

            if (gridViewCloseDay.IsDataRow(rowHandle))
            {
                WorkingDay = (YearlyWorkingDay)gridViewCloseDay.GetRow(rowHandle);
            }
            return(WorkingDay);
        }
コード例 #2
0
ファイル: CloseDaysListEx.cs プロジェクト: 5509850/baumax
        public YearlyWorkingDay CloseDayExists(long countryid, DateTime date)
        {
            CountryCloseDaysListEx item  = this[countryid];
            YearlyWorkingDay       feast = null;

            if (item != null)
            {
                item.TryGetValue(date, out feast);
            }

            return(feast);
        }
コード例 #3
0
ファイル: UCClosedDays.cs プロジェクト: 5509850/baumax
 private void gridViewWorkingDay_CustomUnboundColumnData(object sender, CustomColumnDataEventArgs e)
 {
     if (e.Column == gc_DayOfWeek)
     {
         if (e.IsGetData)
         {
             int idx = e.ListSourceRowIndex;
             if (idx >= 0 && idx < ListOfClosedDays.Count)
             {
                 YearlyWorkingDay wday = ListOfClosedDays[e.ListSourceRowIndex];
                 e.Value = m_weekDays[(int)wday.WorkingDay.DayOfWeek];
             }
         }
     }
 }
コード例 #4
0
        protected override void readCSVFile(CachedCsvReader csv)
        {
#if (UseHeaders)
            int systemID1Index  = csv.GetFieldIndex(_VLID);
            int workingDayIndex = csv.GetFieldIndex(_WorkingDay);
#else
            int systemID1Index  = _VLIDIndex;
            int workingDayIndex = _WorkingDayIndex;
#endif
            Dictionary <string, YearlyWorkingDay> dbWorkingDayHash   = getDBWorkingDayList();
            Dictionary <string, long>             countrySysKeyIDKey = getDBCountryListSysKeyIDKey();
            List <YearlyWorkingDay> importWDayList = new List <YearlyWorkingDay>();


            while (csv.ReadNextRecord())
            {
                csvDataNextRow();
                string workingDay    = csv[workingDayIndex];
                string keyCountry    = csv[systemID1Index];
                string keyWorkingDay = keyCountry + workingDay;

                if (!dbWorkingDayHash.ContainsKey(keyWorkingDay))
                {
                    if (countrySysKeyIDKey.ContainsKey(keyCountry))
                    {
                        YearlyWorkingDay yearlyWorkingDay = new YearlyWorkingDay();
                        yearlyWorkingDay.CountryID  = countrySysKeyIDKey[keyCountry];
                        yearlyWorkingDay.WorkingDay = DateTime.ParseExact(workingDay, "yyyyMMdd", null);
                        importWDayList.Add(yearlyWorkingDay);
                        dbWorkingDayHash.Add(keyWorkingDay, yearlyWorkingDay);
                    }
                    else
                    {
                        message(string.Format(GetLocalized("CountryNotExistsDB"), _CurrentRow, _VLID, keyCountry));
                    }
                }
                else
                {
                    message(string.Format(GetLocalized("WorkingDayExistsDB"), _CurrentRow));
                }
            }
            csvDataEndRead();

            SaveList <YearlyWorkingDay>(_IContryServise.YearlyWorkingDayService, importWDayList);
        }
コード例 #5
0
ファイル: UCClosedDays.cs プロジェクト: 5509850/baumax
        public bool DeleteEntity(YearlyWorkingDay amount)
        {
            YearlyWorkingDay am = amount;

            if (am == null)
            {
                return(false);
            }
            if (am.WorkingDay < DateTime.Now.Date || UCCountryEdit.IsEstimationExist(am.WorkingDay, Country.ID))
            {
                return(false);
            }

            try
            {
                ClientEnvironment.YearlyWorkingDayService.DeleteByID(am.ID);
                YearlyWorkingDay removing = ListOfClosedDays.GetItemByID(am.ID);
                if (removing != null)
                {
                    ListOfClosedDays.Remove(removing);
                    UpdateEnableButton();
                    return(true);
                }
            }
            catch (ValidationException)
            {
                ErrorMessage("CantDeleteYearlyAppearance");
                return(false);
            }
            catch (EntityException ex)
            {
                ProcessEntityException(ex);
                return(false);
            }
            return(false);
        }