Exemple #1
0
        public override void ProcessRequest(HttpContext context)
        {
            //CultureInfo.
            IList <EventInfo> events = new List <EventInfo>();

            events.Add(new EventInfo {
                BackgroundColor = "#9bb845", TextColor = "#000000", Id = "1", Name = "明天中午去趟肯得鸡", Description = "", StartDate = Convert.ToDateTime("2013-01-02"), AllDayLong = true, UserID = 1, EndDate = Convert.ToDateTime("2013-01-02")
            });
            events.Add(new EventInfo {
                BackgroundColor = "red", TextColor = "#ffffff", Id = "2", Name = "上午12点到2点开会", Description = "", StartDate = Convert.ToDateTime("2013-01-02 08:00"), AllDayLong = false, UserID = 1, EndDate = Convert.ToDateTime("2013-01-02 08:30")
            });
            events.Add(new EventInfo {
                BackgroundColor = "blue", TextColor = "#ffffff", Id = "2", Name = "上午12点到2点开会", Description = "", StartDate = Convert.ToDateTime("2013-01-03 08:00"), AllDayLong = false, UserID = 1, EndDate = Convert.ToDateTime("2013-01-03 08:30")
            });
            events.Add(new EventInfo {
                BackgroundColor = "yellow", TextColor = "#ffffff", Id = "2", Name = "上午12点到2点开会", Description = "", StartDate = Convert.ToDateTime("2013-01-09 12:30:00"), AllDayLong = false, UserID = 1, EndDate = Convert.ToDateTime("2013-01-09 15:30:00")
            });
            IList <CalendarInfo> Calendars = new List <CalendarInfo>();

            Calendars.Add(new CalendarInfo {
                Events = events, BackgroundColor = "#9bb845", TextColor = "#000000", Name = "我的日程", Id = 1, UserID = 1, Description = "自已的",
            });
            CalendarInfo Calendar = new CalendarInfo {
                Events = events, BackgroundColor = "rgb(255, 180, 3)", TextColor = "rgb(203, 89, 186)", Name = "我的日程", Id = 1, UserID = 1, Description = "自已的",
            };
            string json = JsonHelper.SeriObject(events);

            context.Response.Write(json);
        }
Exemple #2
0
        private void toolStripButtonDelete_Click(object sender, EventArgs e)
        {
            if (this.listViewCalendar.SelectedItems.Count > 0)
            {
                DialogResult res = MessageBox.Show(this, "¿Desea eliminar la calendarización?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (res == DialogResult.Yes)
                {
                    CalendarInfo cal = ((CalendarItem)this.listViewCalendar.SelectedItems[0]).CalendarInfo;
                    this.listViewCalendar.Items.Remove((CalendarItem)this.listViewCalendar.SelectedItems[0]);


                    if (this.listViewCalendar.Items.Count == 0 || listViewCalendar.SelectedItems.Count == 0)
                    {
                        this.toolStripButtonDelete.Enabled = false;
                    }
                    try
                    {
                        added.Remove(cal);
                        OfficeApplication.OfficeDocumentProxy.deleteCalendar(pageInformation, cal);
                        loadCalendars();
                    }
                    catch (Exception ue)
                    {
                        OfficeApplication.WriteError(ue);
                    }
                }
            }
            if (this.listViewCalendar.SelectedItems.Count == 0)
            {
                this.toolStripButtonDelete.Enabled = false;
            }
        }
Exemple #3
0
        public override void EndElement(string endElement)
        {
            if ("instrument" == endElement)
            {
                long   id   = GetLongValue(Id, 0L);
                String name = GetStringValue(Name);

                string symbol     = GetStringValue(Symbol);
                string isin       = GetStringValue(UnderlyingIsin);
                string assetClass = GetStringValue(AssetClass);

                UnderlyingInfo underlying = new UnderlyingInfo(symbol, isin, assetClass);

                DateTime         startTime   = GetDateTime(StartTime, DateTime.MinValue);
                DateTime?        expiryTime  = GetDateTime(EndTime);
                TimeSpan         openOffset  = GetTimeSpan(OpeningOffset, TimeSpan.MinValue);
                TimeSpan         closeOffset = GetTimeSpan(ClosingOffset, TimeSpan.MinValue);
                string           timeZone    = GetStringValue(Timezone);
                List <DayOfWeek> daysOfWeek  = GetDaysOfWeek();

                CalendarInfo calendarInfo = new CalendarInfo(startTime, expiryTime, openOffset, closeOffset, timeZone, daysOfWeek);

                decimal marginRate      = GetDecimalValue(Margin, 0);
                decimal maximumPosition = GetDecimalValue(MaximumPositionThreshold, 0);

                RiskInfo riskInfo = new RiskInfo(marginRate, maximumPosition);

                decimal priceIncrement           = GetDecimalValue(PriceIncrement, 0);
                decimal quantityIncrement        = GetDecimalValue(OrderQuantityIncrement, 0);
                decimal volatilityBandPercentage = GetDecimalValue(RetailVolatilityBandPercentage, 0);

                OrderBookInfo orderBookInfo = new OrderBookInfo(priceIncrement, quantityIncrement, volatilityBandPercentage);

                string  currency      = GetStringValue(Currency);
                decimal unitPrice     = GetDecimalValue(UnitPrice, 0);
                string  unitOfMeasure = GetStringValue(ContractUnitMeasure);
                decimal contractSize  = GetDecimalValue(ContractSize, 0);

                ContractInfo contractInfo = new ContractInfo(currency, unitPrice, unitOfMeasure, contractSize);

                decimal minimumCommission               = GetDecimalValue(MinimumCommission, 0);
                decimal?aggressiveCommissionRate        = GetDecimalValue(AggressiveCommisionRate);
                decimal?passiveCommissionRate           = GetDecimalValue(PassiveCommissionRate);
                decimal?aggressiveCommissionPerContract = GetDecimalValue(AggressiveCommissionPerContract);
                decimal?passiveCommissionPerContract    = GetDecimalValue(PassiveCommissionPerContract);
                string  fundingBaseRate            = GetStringValue(FundingBaseRate);
                int     dailyInterestRateBasis     = GetIntValue(DailyInteresetRateBasis, 0);
                decimal?fundingPremiumPercentage   = GetDecimalValue(FundingPremiumPercentage);
                decimal?fundingReductionPercentage = GetDecimalValue(FundingReductionPercentage);
                decimal?longSwapPoints             = GetDecimalValue(LongSwapPoints);
                decimal?shortSwapPoints            = GetDecimalValue(ShortSwapPoints);

                CommercialInfo commercialInfo = new CommercialInfo(minimumCommission, aggressiveCommissionRate, passiveCommissionRate,
                                                                   aggressiveCommissionPerContract, passiveCommissionPerContract,
                                                                   fundingBaseRate, dailyInterestRateBasis,
                                                                   fundingPremiumPercentage, fundingReductionPercentage, longSwapPoints, shortSwapPoints);

                _instruments.Add(new Instrument(id, name, underlying, calendarInfo, riskInfo, orderBookInfo, contractInfo, commercialInfo));
            }
        }
Exemple #4
0
        public ContentResult Save(int?id, FormCollection actionValues)
        {
            var    entityContext = new EntityContext();
            var    action        = new DataAction(actionValues);
            var    cInfo         = new CalendarInfo();
            int    Id            = 0;
            string typeOfAction  = string.Empty;

            try
            {
                var maxData = entityContext.calendarInfo.Where(q => q.Type == "TempleEvent").ToList();
                if (maxData != null && maxData.Count > 0)
                {
                    var maxId = maxData?.Max(q => q.Id);
                    Id = maxId.Value;
                }
                var changedEvent = (CalendarEvent)DHXEventsHelper.Bind(typeof(CalendarEvent), actionValues);
                switch (action.Type)
                {
                case DataActionTypes.Insert:
                {
                    //cInfo.Id = ++Id; cInfo.Text = changedEvent.text; cInfo.StartDate = changedEvent.start_date; cInfo.EndDate = changedEvent.end_date; cInfo.Type = "TempleEvent";
                    //entityContext.calendarInfo.Add(cInfo);
                    //typeOfAction = "Temple Event Created";
                }
                break;

                case DataActionTypes.Delete:
                {
                    cInfo = entityContext.calendarInfo.FirstOrDefault(q => q.Id == changedEvent.id);
                    var report = entityContext.reportInfo.FirstOrDefault(q => q.ReferenceTxnID == cInfo.ReferenceTxnID);
                    entityContext.reportInfo.Remove(report);
                    entityContext.calendarInfo.Remove(cInfo);
                    typeOfAction = "Temple Event Cancelled;" + report.FromEmailAddress;
                    entityContext.SaveChanges();
                    cInfo.Name = $"{cInfo.Name} {report.PhoneNo} {cInfo.Text}";
                    Notifications.NotificationToAdmins(typeOfAction, cInfo);
                }
                break;

                default:    // "update"
                {
                    //cInfo = entityContext.calendarInfo.FirstOrDefault(q => q.Id == changedEvent.id);
                    //cInfo.Id = changedEvent.id; cInfo.Text = changedEvent.text; cInfo.StartDate = changedEvent.start_date; cInfo.EndDate = changedEvent.end_date; cInfo.Type = "TempleEvent";
                    //entityContext.calendarInfo.AddOrUpdate(cInfo);
                    //typeOfAction = "Temple Event Modified";
                }
                break;
                }
            }
            catch (Exception ex)
            {
                action.Type = DataActionTypes.Error;
            }
            ViewBag.schedule = GetScheduler();
            //return (ContentResult)Index();
            return((ContentResult) new AjaxSaveResponse(action));
        }
Exemple #5
0
        protected override void CalcDayCells()
        {
            DayCells.Clear();
            RowCount    = GetCellRowCount();
            ColumnCount = GetCellColumnCount();

            var rightToLeftLayout = WindowsFormsSettings.GetIsRightToLeftLayout(Calendar);
            var y = DayCellsBounds.Y;

            for (var iRow = 0; iRow < RowCount; ++iRow)
            {
                var x = rightToLeftLayout ? DayCellsBounds.Right - ActualCellSize.Width : DayCellsBounds.X;
                for (var iCol = 0; iCol < ColumnCount; ++iCol)
                {
                    bool correctDate;

                    if (iRow == 0)
                    {
                        if (iCol < PenaltyIndex)
                        {
                            x += rightToLeftLayout ? -ActualCellSize.Width : ActualCellSize.Width;
                            continue;
                        }
                    }

                    DateTime date;
                    try
                    {
                        date = CalcDate(iRow, iCol, out correctDate);
                    }
                    catch
                    {
                        iRow = RowCount;
                        break;
                    }

                    if (correctDate && CanAddDate(date))
                    {
                        var dayCell = (PersianCalendarCellViewInfo)CreateDayCell(date);
                        dayCell.UpdateVisualState();
                        dayCell.Bounds        = CalcCellBounds(x, y);
                        dayCell.Text          = GetCellText(date, iRow, iCol);
                        dayCell.ContentBounds = CalcDayCellContentBounds(dayCell.Bounds);
                        dayCell.CalculateTextBounds();
                        dayCell.Row    = iRow;
                        dayCell.Column = iCol;

                        UpdateDayCell(dayCell);
                        DayCells.Add(dayCell);
                        CalendarInfo.AddCellToNavigationGrid(dayCell, Row, Column, iRow, iCol);
                    }

                    x += rightToLeftLayout ? -ActualCellSize.Width : ActualCellSize.Width;
                }

                y += ActualCellSize.Height;
            }
        }
Exemple #6
0
 public IActionResult DeleteEvent([FromBody] CalendarInfo data)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest("Not a Valid Model"));
     }
     calendarService.DeleteEvent(data);
     return(Ok());
 }
        private void RemoveButton_Click(object sender, EventArgs e)
        {
            CalendarInfo infoToRemove = FindInfoFromField(SchedulerList.SelectedItem.ToString());

            if (infoToRemove != null)
            {
                calenderData.Remove(infoToRemove);
            }
            RefreshListView();
        }
Exemple #8
0
        private List <ShowCalendarDay> planCalendar(CalendarInfo check)
        {
            var startDate = DateTime.ParseExact(check.FDate, "dd/MM/yyyy", null);

            var endDate = DateTime.ParseExact(check.TDate, "dd/MM/yyyy", null);

            List <ShowCalendarDay> planTimes = new List <ShowCalendarDay>();

            for (DateTime date = startDate; date <= endDate;)
            {
                ShowCalendarDay data = new ShowCalendarDay()
                {
                    date      = date.ToString("dd/MM/yyyy"),
                    code      = date.ToString("ddMMyyyy"),
                    dayOfWeek = mapDayOfWeeks[date.DayOfWeek],
                    plan      = new List <ShowCalendarAgency>(),
                    work      = new List <ShowCalendarAgency>()
                };

                var planCode = date.ToString("ddMMyyyy");

                var listPlan = db.CalendarPlans.Where(p => p.CalendarId == check.Id && p.CDate == planCode).ToList();

                foreach (var item in listPlan)
                {
                    data.plan.Add(new ShowCalendarAgency()
                    {
                        id     = item.MAgency.Id,
                        code   = item.MAgency.Code,
                        name   = item.MAgency.Store,
                        target = item.Targets.Value.ToString("C", Util.Cultures.VietNam)
                    });
                }

                var listWork = db.CalendarWorks.Where(p => p.StaffId == check.StaffId && p.CDate == planCode && p.Perform == 1).ToList();

                foreach (var item in listWork)
                {
                    data.work.Add(new ShowCalendarAgency()
                    {
                        id   = item.MAgency.Id,
                        code = item.MAgency.Code,
                        name = item.MAgency.Store
                    });
                }


                planTimes.Add(data);

                date = date.AddDays(1);
            }

            return(planTimes);
        }
 public Instrument(long id, string name, UnderlyingInfo underlying, CalendarInfo calendar, RiskInfo risk, OrderBookInfo orderBook, ContractInfo contract, CommercialInfo commercial)
 {
     this._id         = id;
     this._name       = name;
     this._underlying = underlying;
     this._calendar   = calendar;
     this._risk       = risk;
     this._orderBook  = orderBook;
     this._contract   = contract;
     this._commercial = commercial;
 }
Exemple #10
0
        public ActionResult Add(int week, int year, string staffChoose, string title)
        {
            int CurrentWeek = GetIso8601WeekOfYear(DateTime.Now);

            if (week <= 0 || week > 52 || week < CurrentWeek)
            {
                return(Redirect("/error"));
            }

            if (year < DateTime.Now.Year)
            {
                return(Redirect("/error"));
            }

            var firstWeekCreate = FirstDateOfWeekISO8601(year, week);

            var fDate = firstWeekCreate.ToString("dd/MM/yyyy");

            var tDate = firstWeekCreate.AddDays(5).ToString("dd/MM/yyyy");

            var staffCheck = db.MStaffs.Find(staffChoose);

            if (staffChoose == null)
            {
                return(Redirect("/error"));
            }

            var checkCalendar = db.CalendarInfoes.Where(p => p.WeekOfYear == week && p.CYear == year && p.StaffId == staffCheck.Id).FirstOrDefault();

            if (checkCalendar != null)
            {
                return(RedirectToAction("edit", "calendar", new { id = checkCalendar.Id }));
            }



            var calendarInfo = new CalendarInfo()
            {
                Id         = Guid.NewGuid().ToString(),
                Title      = title,
                WeekOfYear = week,
                CYear      = year,
                CStatus    = 0,
                CreateTine = DateTime.Now,
                FDate      = fDate,
                TDate      = tDate,
                StaffId    = staffCheck.Id
            };

            db.CalendarInfoes.Add(calendarInfo);
            db.SaveChanges();

            return(RedirectToAction("edit", "calendar", new { id = calendarInfo.Id }));
        }
Exemple #11
0
        public ContentResult Save(int?id, FormCollection actionValues)
        {
            var    entityContext = new EntityContext();
            var    action        = new DataAction(actionValues);
            var    cInfo         = new CalendarInfo();
            int    Id            = 0;
            string typeOfAction  = string.Empty;

            try
            {
                var maxData = entityContext.calendarInfo.Where(q => q.Type == "Room").ToList();
                if (maxData != null && maxData.Count > 0)
                {
                    var maxId = maxData?.Max(q => q.Id);
                    Id = maxId.Value;
                }
                var changedEvent = (CalendarEvent)DHXEventsHelper.Bind(typeof(CalendarEvent), actionValues);
                switch (action.Type)
                {
                case DataActionTypes.Insert:
                {
                    cInfo.Id = ++Id; cInfo.Text = changedEvent.text; cInfo.StartDate = changedEvent.start_date; cInfo.EndDate = changedEvent.end_date; cInfo.Type = "Room";
                    entityContext.calendarInfo.Add(cInfo);
                    typeOfAction = "New Room Booked";
                }
                break;

                case DataActionTypes.Delete:
                {
                    cInfo = entityContext.calendarInfo.FirstOrDefault(q => q.Id == changedEvent.id);
                    entityContext.calendarInfo.Remove(cInfo);
                    typeOfAction = "Cancel the Room";
                }
                break;

                default:    // "update"
                {
                    cInfo    = entityContext.calendarInfo.FirstOrDefault(q => q.Id == changedEvent.id);
                    cInfo.Id = changedEvent.id; cInfo.Text = changedEvent.text; cInfo.StartDate = changedEvent.start_date; cInfo.EndDate = changedEvent.end_date; cInfo.Type = "Room";
                    entityContext.calendarInfo.AddOrUpdate(cInfo);
                    typeOfAction = "Modified the Room";
                }
                break;
                }
                entityContext.SaveChanges();
                Notifications.NotificationToAdmins(typeOfAction, cInfo);
            }
            catch (Exception ex)
            {
                action.Type = DataActionTypes.Error;
            }
            return((ContentResult) new AjaxSaveResponse(action));
        }
Exemple #12
0
 public CalendarItem(CalendarInfo info)
 {
     this.info = info;
     this.Text = info.title;
     if (info.active)
     {
         this.SubItems.Add("Si");
     }
     else
     {
         this.SubItems.Add("No");
     }
 }
        private void SchedulerList_SelectedValueChanged(object sender, EventArgs e)
        {
            selectedInfo = FindInfoFromField(SchedulerList.SelectedItem.ToString());
            bool hasData = selectedInfo != null;

            if (hasData)
            {
                DetailsText.Text = selectedInfo.details;
                FromText.Text    = selectedInfo.from;
                ToText.Text      = selectedInfo.to;
            }
            ToggleButtons(hasData);
        }
Exemple #14
0
        // on document starting show tag input form to the user and initialize document tags
        private void _printDoc_DocumentStarting(object sender, EventArgs e)
        {
            DateTime     start        = _schedule.VisibleDates[0].Date;
            DateTime     end          = _schedule.VisibleDates[_schedule.VisibleDates.Count - 1].Date;
            CalendarInfo calendarInfo = _schedule.CalendarHelper.Info;

            // Show tag input form to end-user.
            // This is a default form shown by the C1PrintDocument control.
            // You can create your own form for this purpose, show it, and set C1PrintDocumentTags
            // according to the user's input.
            PrintDocument.EditTags();

            CurrentStyle.SetupTags(PrintDocument, _schedule.DataStorage.AppointmentStorage.Appointments,
                                   _currentAppointments, start, end, HidePrivateAppointments, calendarInfo);
        }
Exemple #15
0
        /// <summary>
        /// 是否缴纳物业费
        /// </summary>
        /// <returns></returns>
        public static PropertyExpend GetPropertyExpend(string vehicleNo)
        {
            PropertyExpend propertyExpend = null;

            try
            {
                CalendarInfo calendarInfo = new CalendarInfo();
                //获取当前工作站
                string url      = ConfigurationManager.AppSettings["serverUrl"].ToString();
                string authCode = CommHelper.Str(6);
                string token    = CommHelper.Md5(CommHelper.StringToHexString(authCode)).ToUpper();
                string data     = "authCode=" + authCode + "&token=" + token + "&vehicleNo=" + vehicleNo;
                string result   = CommHelper.Post(url + "/propertyExpendQuery.eif?", data);
                propertyExpend = CommHelper.FromJsonTo <PropertyExpend>(result);
            }
            catch { return(null); }
            return(propertyExpend);
        }
Exemple #16
0
 private void toolStripButtonDelete_Click(object sender, EventArgs e)
 {
     if (this.listBoxCalendars.SelectedItem != null)
     {
         CalendarInfo cal = (CalendarInfo)this.listBoxCalendars.SelectedItem;
         DialogResult res = MessageBox.Show(this, "¿Deseas eliminar la calendarización?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (res == DialogResult.Yes)
         {
             try
             {
                 this.Cursor = Cursors.WaitCursor;
                 bool canDelete = OfficeApplication.OfficeApplicationProxy.canDeleteCalendar(this.resourceInfo.page.site, cal);
                 if (canDelete)
                 {
                     OfficeApplication.OfficeDocumentProxy.deleteCalendarFromCatalog(this.resourceInfo.page.site, cal);
                     fillCalendarList();
                     if (this.listBoxCalendars.SelectedItem == null || this.listBoxCalendars.Items.Count == 0)
                     {
                         this.toolStripButtonDelete.Enabled = false;
                         this.toolStripButtonEdit.Enabled   = false;
                     }
                     else
                     {
                         this.toolStripButtonDelete.Enabled = true;
                         this.toolStripButtonEdit.Enabled   = true;
                     }
                 }
                 else
                 {
                     MessageBox.Show(this, "¡El calendario no se puede borrar, esta siendo utilizado por otro contenido u otro elemento del portal!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 }
             }
             catch (Exception ue)
             {
                 OfficeApplication.WriteError(ue);
             }
             finally
             {
                 this.Cursor = Cursors.Default;
             }
         }
     }
 }
Exemple #17
0
    public void LoadCalendarData(System.Action dataLoadedCallback)
    {
        System.Action <CSVLineDataHandler> lineProcessor = delegate(CSVLineDataHandler lineComponents) {
            CalendarInfo newCalendarInfo = new CalendarInfo();

            string serviceId = lineComponents["service_id"];

            int[] daysArray = new int[7];

            //            if (!lineComponents.ContainsKey("monday")) {
            //                foreach (KeyValuePair<string, string> pair in lineComponents) {
            //                    Debug.LogError(pair.Key);
            //                }
            //            }

            daysArray[0] = int.Parse(lineComponents["monday"]);
            daysArray[1] = int.Parse(lineComponents["tuesday"]);
            daysArray[2] = int.Parse(lineComponents["wednesday"]);
            daysArray[3] = int.Parse(lineComponents["thursday"]);
            daysArray[4] = int.Parse(lineComponents["friday"]);
            daysArray[5] = int.Parse(lineComponents["saturday"]);
            daysArray[6] = int.Parse(lineComponents["sunday"]);

            //            for (int i = 0; i < 7; i++) {
            //                daysArray[i] = int.Parse(lineComponents[i+1]);
            //            }

            newCalendarInfo.serviceId = serviceId;
            newCalendarInfo.days      = daysArray;
            newCalendarInfo.startDate = int.Parse(lineComponents["start_date"]);
            newCalendarInfo.endDate   = int.Parse(lineComponents["end_date"]);

            this.calendarInfoByServiceId.Add(serviceId, newCalendarInfo);
        };

        this.ProcessCSVData(this.calendarTextData.text, lineProcessor, 10, dataLoadedCallback);
    }
Exemple #18
0
 private void toolStripButtonEdit_Click(object sender, EventArgs e)
 {
     if (this.listBoxCalendars.SelectedItem != null)
     {
         CalendarInfo cal = (CalendarInfo)this.listBoxCalendars.SelectedItem;
         if (cal.xml != null)
         {
             FrmPeriodicidad dialogCalendar = new FrmPeriodicidad(cal.active);
             dialogCalendar.textBoxTitle.Text = cal.title;
             XmlDocument document = new XmlDocument();
             document.LoadXml(cal.xml);
             dialogCalendar.Document = document;
             DialogResult res = dialogCalendar.ShowDialog(this);
             if (res == DialogResult.OK)
             {
                 XmlDocument xmlCalendar = dialogCalendar.Document;
                 String      xml         = xmlCalendar.OuterXml;
                 String      title       = dialogCalendar.textBoxTitle.Text;
                 cal.title = title;
                 cal.xml   = xml;
                 try
                 {
                     this.Cursor = Cursors.WaitCursor;
                     OfficeApplication.OfficeDocumentProxy.updateCalendar(resourceInfo.page.site, cal);
                 }
                 catch (Exception ue)
                 {
                     OfficeApplication.WriteError(ue);
                 }
                 finally
                 {
                     this.Cursor = Cursors.Default;
                 }
             }
         }
     }
 }
Exemple #19
0
        /// <summary>
        /// 获取节假日信息
        /// </summary>
        /// <returns></returns>
        public static CalendarInfo GetWorkingDays(string dateTime)
        {
            CalendarInfo calendarInfo = null;
            //获取当前工作站
            string      url      = ConfigurationManager.AppSettings["serverUrl"].ToString();
            string      authCode = CommHelper.Str(6);
            string      token    = CommHelper.Md5(CommHelper.StringToHexString(authCode)).ToUpper();
            string      data     = "authCode=" + authCode + "&token=" + token + "&dateTime=" + dateTime;
            string      result   = CommHelper.Post(url + "/workingDaysVal.eif?", data);
            WorkingDays workDay  = CommHelper.FromJsonTo <WorkingDays>(result);

            if (workDay != null)
            {
                if (workDay.resStatus == 1)
                {
                    calendarInfo = workDay.calendarInfo;
                }
                else
                {
                    LogHelper.Log.Error(workDay.resRemark);
                }
            }
            return(calendarInfo);
        }
Exemple #20
0
        private void toolStripButtonAdd_Click(object sender, EventArgs e)
        {
            FormCalendarList list = new FormCalendarList(pageInformation);
            DialogResult     res  = list.ShowDialog(this);

            if (res == DialogResult.OK)
            {
                if (list.listBoxCalendars.SelectedItem != null)
                {
                    CalendarInfo calendar = (CalendarInfo)list.listBoxCalendars.SelectedItem;
                    bool         exists   = false;
                    int          count    = this.listViewCalendar.Items.Count;
                    for (int i = 0; i < count; i++)
                    {
                        CalendarItem calactual = (CalendarItem)this.listViewCalendar.Items[i];
                        if (calactual.CalendarInfo.id.Equals(calendar.id))
                        {
                            exists = true;
                            break;
                        }
                    }
                    if (!exists)
                    {
                        try
                        {
                            added.Add(calendar);
                        }
                        catch (Exception ue)
                        {
                            OfficeApplication.WriteError(ue);
                        }
                    }
                }
            }
            loadCalendars();
        }
        // Use this method to set all tags at document starting.
        // Note: start and end parameters are just default values.
        // If document contains StartDate and EndDate tags,
        // actual start and end values go from the tags.
        internal void SetupTags(C1PrintDocument printDoc, AppointmentCollection appointmentCollection,
                                List <Appointment> appointmentList, DateTime start, DateTime end, bool hidePrivateAppointments, CalendarInfo calendarInfo)
        {
            Tag           tag  = null;
            TagCollection Tags = printDoc.Tags;

            if (Tags.IndexOfName("Appointment") >= 0)
            {
                tag = Tags["Appointment"];
                if (tag != null && tag.Type == typeof(Appointment) &&
                    appointmentList != null && appointmentList.Count > 0)
                {
                    tag.Value = appointmentList[0];
                }
            }
            if (Tags.IndexOfName("Appointments") >= 0)
            {
                tag = Tags["Appointments"];
                if (tag != null)
                {
                    if (tag.Type == typeof(AppointmentCollection))
                    {
                        tag.Value = appointmentCollection;
                    }
                    else if (tag.Type == typeof(IList <Appointment>))
                    {
                        if ((Context & PrintContextType.Appointment) != 0 &&
                            appointmentList != null)
                        {
                            appointmentList.Sort(AppointmentComparer.Default);
                            tag.Value = appointmentList;
                        }
                        else
                        {
                            Tag tag1 = null;
                            if (Tags.IndexOfName("StartDate") >= 0)
                            {
                                tag1 = Tags["StartDate"];
                                if (tag1 != null && tag1.Type == typeof(DateTime))
                                {
                                    start = (DateTime)tag1.Value;
                                }
                            }
                            if (Tags.IndexOfName("EndDate") >= 0)
                            {
                                tag1 = Tags["EndDate"];
                                if (tag1 != null && tag1.Type == typeof(DateTime))
                                {
                                    end = (DateTime)tag1.Value;
                                }
                            }
                            C1Scheduler scheduler = ((C1ScheduleStorage)appointmentCollection.ParentStorage.ScheduleStorage).Scheduler;
                            // get appointments for the currently selected SchedulerGroupItem if any,
                            // or all appointments otherwise.
                            AppointmentList list = appointmentCollection.GetOccurrences(
                                scheduler.SelectedGroupItem == null ? null : scheduler.SelectedGroupItem.Owner,
                                scheduler.GroupBy, start, end.AddDays(1), !hidePrivateAppointments);
                            list.Sort();
                            tag.Value = list;
                        }
                    }
                }
            }
            if (Tags.IndexOfName("CalendarInfo") >= 0)
            {
                tag = Tags["CalendarInfo"];
                if (tag != null && tag.Type == typeof(CalendarInfo))
                {
                    tag.Value = calendarInfo;
                }
            }
            if (Tags.IndexOfName("HidePrivateAppointments") >= 0)
            {
                tag = Tags["HidePrivateAppointments"];
                if (tag != null && tag.Type == typeof(bool))
                {
                    tag.Value = hidePrivateAppointments;
                }
            }
            // update string tags
            foreach (Tag t in Tags)
            {
                if (t.Type == typeof(string))
                {
                    string key = t.Name.ToLower();
                    switch (key)
                    {
                    case "start":
                        key = "startTime";
                        break;

                    case "end":
                        key = "endTime";
                        break;

                    case "showtimeas":
                        key = "showTimeAs";
                        break;

                    case "contacts":
                        key = "contactsButton";
                        break;

                    case "resources":
                        key = "resourcesButton";
                        break;

                    case "categories":
                        key = "categoriesButton";
                        break;
                    }
                    if (!string.IsNullOrEmpty(key))
                    {
                        // try find localized value from the Scheduler resources
                        string str = C1.WPF.Localization.C1Localizer.GetString("EditAppointment", key, (string)t.Value).Trim();
                        if (!string.IsNullOrEmpty(str))
                        {
                            while (str.EndsWith("."))
                            {
                                str = str.Substring(0, str.Length - 1);
                            }
                            if (!str.EndsWith(":"))
                            {
                                str += ":";
                            }
                            t.Value = str;
                        }
                    }
                }
            }
        }
Exemple #22
0
 public void Dispose()
 {
     _info = null;
     ClearAppointments();
     ClearItems();
 }
Exemple #23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DayCollection"/> class.
 /// </summary>
 internal DayCollection(CalendarInfo info)
 {
     _info        = info;
     _boldedDates = new DateList();
 }
Exemple #24
0
 public void DeleteEvent(CalendarInfo data)
 {
     _dbContext.CalendarInfos.Remove(data);
     _dbContext.SaveChanges();
 }
Exemple #25
0
 public void UpdateEvent(CalendarInfo data)
 {
     _dbContext.CalendarInfos.Update(data);
     _dbContext.SaveChanges();
 }
Exemple #26
0
 public void InsertNewEvent(CalendarInfo data)
 {
     _dbContext.CalendarInfos.Add(data);
     _dbContext.SaveChanges();
 }
Exemple #27
0
        public ActionResult Index(MyNPO.Models.PriestServices priestServices)
        {
            try
            {
                ViewBag.schedule = GetScheduler();
                if (ModelState.IsValid)
                {
                    var           guid          = Guid.NewGuid();
                    var           dt            = DateTime.Now;
                    EntityContext entityContext = new EntityContext();


                    var cInfo = entityContext.calendarInfo.FirstOrDefault(q => q.Id == priestServices.Id && q.Type == "TempleEvent");
                    if (cInfo != null)
                    {
                        cInfo.Name      = priestServices.Name; cInfo.Text = priestServices.PriestServicesList;
                        cInfo.StartDate = priestServices.EventsDate;
                        cInfo.EndDate   = priestServices.EventsDate.AddHours(1);
                        cInfo.Gothram   = priestServices.Gothram; cInfo.Address = priestServices.Address;

                        entityContext.Entry(cInfo).State = System.Data.Entity.EntityState.Modified;
                        entityContext.calendarInfo.AddOrUpdate(cInfo);

                        var rInfo = entityContext.reportInfo.FirstOrDefault(q => q.ReferenceTxnID == cInfo.ReferenceTxnID);
                        if (rInfo != null)
                        {
                            rInfo.Name         = priestServices.Name; rInfo.FromEmailAddress = priestServices.Email; rInfo.Net = GetPriceByService(priestServices.PriestServicesList);
                            rInfo.PhoneNo      = priestServices.Phone; rInfo.PriestServicesList = priestServices.PriestServicesList; rInfo.Date = dt;
                            rInfo.Reason       = priestServices.Comments; rInfo.Description = priestServices.PaymentMode == "1" ? "PayPal" : priestServices.PaymentMode == "2" ? "Cash" : "Cheque";
                            rInfo.CurrencyType = rInfo.Description;
                            rInfo.TypeOfReport = Constants.PriestService;
                        }

                        if (priestServices.PaymentMode == "1")
                        {
                            rInfo.Net = "0"; // the reason of set 0, we will upload the paypal report later.
                        }
                        entityContext.Entry(rInfo).State = System.Data.Entity.EntityState.Modified;
                        entityContext.reportInfo.AddOrUpdate(rInfo);
                        entityContext.SaveChanges();

                        ModelState.Clear();
                        ViewBag.Status = "Successfully Updated";
                    }
                    else
                    {
                        // Generate the transaction id for cash transactions
                        var existingTransactionsPerDay = entityContext.reportInfo.Where(x => x.Date.Day == DateTime.Today.Day).ToList().Count;
                        var prefixCount = existingTransactionsPerDay <= 0 ? 1 : existingTransactionsPerDay + 1;

                        var transactionId = DateTime.Now.Date.ToString("yyyyMMdd") + "-" + prefixCount;

                        var report = new Report()
                        {
                            Name             = priestServices.Name,
                            TransactionID    = transactionId,
                            FromEmailAddress = priestServices.Email,
                            Net                = GetPriceByService(priestServices.PriestServicesList),
                            PhoneNo            = priestServices.Phone,
                            PriestServicesList = priestServices.PriestServicesList,
                            Date               = dt,
                            Time               = dt.ToString(Constants.HourFormat),
                            Reason             = priestServices.Comments, // Plan to LoginUser
                            Description        = priestServices.PaymentMode == "1" ? "PayPal" : priestServices.PaymentMode == "2" ? "Cash" : "Cheque",
                            TransactionGuid    = guid,
                            ReferenceTxnID     = guid.ToString().Replace("-", ""),
                            UploadDateTime     = dt,
                            TypeOfReport       = Constants.PriestService,
                            CurrencyType       = priestServices.PaymentMode == "1" ? "PayPal" : priestServices.PaymentMode == "2" ? "Cash" : "Cheque"
                        };

                        if (priestServices.PaymentMode == "1")
                        {
                            report.Net = "0";//// the reason of set 0, we will upload the paypal report later.
                        }
                        entityContext.reportInfo.Add(report);

                        // TODO: Add insert logic here
                        ModelState.Clear();
                        ViewBag.Status = "Successfully Saved";


                        cInfo = new CalendarInfo();
                        int    Id           = 0;
                        string typeOfAction = string.Empty;
                        try
                        {
                            var maxData = entityContext.calendarInfo.Where(q => q.Type == "TempleEvent").ToList();
                            if (maxData != null && maxData.Count > 0)
                            {
                                var maxId = maxData?.Max(q => q.Id);
                                Id = maxId.Value;
                            }
                            cInfo.Id             = ++Id; cInfo.Name = priestServices.Name; cInfo.Text = priestServices.PriestServicesList;
                            cInfo.ReferenceTxnID = report.ReferenceTxnID;
                            cInfo.StartDate      = priestServices.EventsDate; cInfo.Type = "TempleEvent";
                            cInfo.EndDate        = priestServices.EventsDate.AddHours(1);
                            cInfo.Gothram        = priestServices.Gothram; cInfo.Address = priestServices.Address;

                            entityContext.calendarInfo.Add(cInfo);
                        }
                        catch (Exception ex)
                        {
                        }
                        // Generated PDF Receipt and Send email attachment.
                        // ReceiptGenerator.GenerateDonationReceiptPdf(priestServices, report);
                        entityContext.SaveChanges();
                        cInfo.Name = $"{cInfo.Name} {report.PhoneNo} {cInfo.Text}";
                        Notifications.NotificationToAdmins("Temple Priest Service;" + priestServices.Email, cInfo);
                    }
                    //priestServices = new PriestServices();
                    //priestServices.Scheduler = GetScheduler();
                    return(View());
                }
                else
                {
                    return(View(priestServices));
                }
            }
            catch (Exception ex)
            {
                throw ex;
                //return View();
            }
        }
Exemple #28
0
        public ResultInfo CalendarCreate()
        {
            var log = new MongoHistoryAPI()
            {
                APIUrl     = "/api/checkin/calendarcreate",
                CreateTime = DateTime.Now,
                Sucess     = 1
            };

            var result = new ResultInfo()
            {
                id  = "1",
                msg = "success"
            };

            var requestContent = Request.Content.ReadAsStringAsync().Result;

            try
            {
                var jsonserializer = new JavaScriptSerializer();
                var paser          = jsonserializer.Deserialize <CalendarCreateRequest>(requestContent);
                log.Content = new JavaScriptSerializer().Serialize(paser);

                if (!mongoHelper.checkLoginSession(paser.user, paser.token))
                {
                    throw new Exception("Wrong token and user login!");
                }

                var staff = db.HaiStaffs.Where(p => p.UserLogin == paser.user).FirstOrDefault();

                if (staff == null)
                {
                    throw new Exception("Chỉ nhân viên công ty mới được quyền tạo");
                }

                var checkCalendar = db.CalendarInfoes.Where(p => p.CMonth == paser.month && p.CYear == paser.year && p.StaffId == staff.Id).FirstOrDefault();

                if (checkCalendar != null)
                {
                    throw new Exception("Kế hoạch này đã được tạo");
                }

                // lap lich
                // luu lich voi trang thai chua xac nhan
                var checkInHistory = new CalendarInfo()
                {
                    Id         = Guid.NewGuid().ToString(),
                    CMonth     = paser.month,
                    CYear      = paser.year,
                    CStatus    = 0,
                    CreateTime = DateTime.Now,
                    StaffId    = staff.Id
                };
                db.CalendarInfoes.Add(checkInHistory);
                db.SaveChanges();
                // lich chi tiet
                foreach (var item in paser.items)
                {
                    if (item.agencies == null || item.agencies.Count() == 0)
                    {
                        CalendarWork plan = new CalendarWork()
                        {
                            Id        = Guid.NewGuid().ToString(),
                            CDate     = "D" + item.day + "",
                            CMonth    = paser.month,
                            CYear     = paser.year,
                            CDay      = item.day,
                            InPlan    = 1,
                            Perform   = 1,
                            CIn       = 0,
                            COut      = 0,
                            AllTime   = 0,
                            Distance  = 0,
                            TypeId    = item.status,
                            Notes     = item.notes,
                            StaffId   = staff.Id,
                            DayInWeek = GetDayOfWeek(item.day, paser.month, paser.year),
                            Flexible  = 0
                        };

                        db.CalendarWorks.Add(plan);
                        db.SaveChanges();
                    }
                    else
                    {
                        foreach (var cus in item.agencies)
                        {
                            var checkCus = db.CInfoCommons.Where(p => p.CCode == cus).FirstOrDefault();
                            if (checkCus != null)
                            {
                                CalendarWork plan = new CalendarWork()
                                {
                                    Id         = Guid.NewGuid().ToString(),
                                    CDate      = "D" + item.day + "",
                                    CMonth     = paser.month,
                                    CYear      = paser.year,
                                    CDay       = item.day,
                                    InPlan     = 1,
                                    Perform    = 0,
                                    CIn        = 0,
                                    COut       = 0,
                                    AllTime    = 0,
                                    Distance   = 0,
                                    AgencyCode = checkCus.CCode,
                                    AgencyType = checkCus.CType,
                                    TypeId     = item.status,
                                    Notes      = item.notes,
                                    StaffId    = staff.Id,
                                    DayInWeek  = GetDayOfWeek(item.day, paser.month, paser.year),
                                    Flexible   = 0
                                };

                                db.CalendarWorks.Add(plan);
                                db.SaveChanges();
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                result.id  = "0";
                result.msg = e.Message;
                log.Sucess = 0;
            }

            log.ReturnInfo = new JavaScriptSerializer().Serialize(result);
            mongoHelper.createHistoryAPI(log);

            return(result);
        }
Exemple #29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DayCollection"/> class.
 /// </summary>
 internal DayCollection(CalendarInfo info)
 {
     _info        = info;
     _boldedDates = new C1.C1Schedule.DateList();
 }
Exemple #30
0
 public void InsertNewEvent([FromBody] CalendarInfo data)
 {
     calendarService.InsertNewEvent(data);
 }