/// <summary> /// Base ctor to initialize the messages /// </summary> /// <param name="merchantID">Google Checkout Merchant ID</param> /// <param name="merchantKey">Google Checkout Merchant Key</param> /// <param name="env">A String representation of /// <see cref="EnvironmentType"/></param> /// <param name="googleOrderNumber">The Google Order Number</param> /// <param name="cart">The shopping cart to post</param> public OrderRecurrenceRequest(string merchantID, string merchantKey, string env, string googleOrderNumber, AutoGen.ShoppingCart cart) : base(merchantID, merchantKey, env, googleOrderNumber) { _cart = cart; }
public AnonymousAddress(AutoGen.AnonymousAddress ThisAddress) { _City = ThisAddress.city; _CountryCode = ThisAddress.countrycode; _Id = ThisAddress.id; _PostalCode = ThisAddress.postalcode; _Region = ThisAddress.region; }
/// <summary> /// Process a Merchant Calculation callback. /// </summary> /// <param name="Callback">The Callback message.</param> public Order(AutoGen.MerchantCalculationCallback Callback) { _OrderLines = new ArrayList(); for (int i = 0; i < Callback.shoppingcart.items.Length; i++) { AutoGen.Item ThisItem = Callback.shoppingcart.items[i]; XmlNode[] merchantItemPrivateDataNodes = new XmlNode[] {}; if (ThisItem.merchantprivateitemdata != null && ThisItem.merchantprivateitemdata.Any != null && ThisItem.merchantprivateitemdata.Any.Length > 0) { merchantItemPrivateDataNodes = ThisItem.merchantprivateitemdata.Any; } _OrderLines.Add( new OrderLine(ThisItem.itemname, ThisItem.itemdescription, ThisItem.quantity, ThisItem.unitprice.Value, ThisItem.taxtableselector, merchantItemPrivateDataNodes)); } if (Callback.shoppingcart.merchantprivatedata != null && Callback.shoppingcart.merchantprivatedata.Any != null && Callback.shoppingcart.merchantprivatedata.Any.Length > 0) { _MerchantPrivateDataNodes = Callback.shoppingcart.merchantprivatedata.Any; } }
/// <summary> /// Create a new subscription item passing in the recurrentItem /// </summary> /// <param name="recurrentItem">The item for the subscription</param> /// <param name="period">The period attribute specifies how frequently /// you will charge the customer for the subscription</param> /// <param name="type"> /// The type attribute identifies the type of subscription that you are creating. /// The valid values for this attribute are merchant and google, /// and this specifies who handles the recurrences. /// </param> public Subscription(IShoppingCartItem recurrentItem, AutoGen.DatePeriod period, SubscriptionType type) { this.RecurrentItem = recurrentItem; this.Period = period; this.Type = type; }
/// <summary> /// Convert a coupon adjustment into a merchant code. /// </summary> /// <param name="item">The Gift Certification to convert</param> public MerchantCode(AutoGen.GiftCertificateAdjustment item) { this.CodeType = MerchantCodeType.GiftCertificate; this.AppliedAmount = item.appliedamount.Value; this.CalculatedAmount = item.calculatedamount.Value; this.Code = item.code; this.Message = item.message; }
/// <summary> /// Base ctor to initialize the messages /// </summary> /// <param name="googleOrderNumber">The Google Order Number</param> /// <param name="cart">The shopping cart to post</param> public OrderRecurrenceRequest(string googleOrderNumber, AutoGen.ShoppingCart cart) : base(GCheckoutConfigurationHelper.MerchantID.ToString(), GCheckoutConfigurationHelper.MerchantKey, GCheckoutConfigurationHelper.Environment.ToString(), googleOrderNumber) { _cart = cart; }
/// <summary> /// Create new instance /// </summary> /// <param name="payment">The payment information</param> public SubscriptionPayment(AutoGen.SubscriptionPayment payment) { if (payment == null) throw new ArgumentNullException("payment"); if (payment.maximumcharge != null) this.MaximumCharge = payment.maximumcharge.Value; if (payment.timesSpecified) this.Times = payment.times; }
public static AVCodec FindDecoder(AutoGen.AVCodecID id) { AutoGen.AVCodec* codec = FFmpegInvoke.avcodec_find_decoder(id); if (codec != null) { return new AVCodec(codec); } return null; }
public Order(AutoGen.MerchantCalculationCallback Callback) { _OrderLines = new ArrayList(); for (int i = 0; i < Callback.shoppingcart.items.Length; i++) { AutoGen.Item ThisItem = Callback.shoppingcart.items[i]; _OrderLines.Add( new OrderLine(ThisItem.itemname, ThisItem.itemdescription, ThisItem.quantity, ThisItem.unitprice.Value, ThisItem.taxtableselector)); } }
public static SWSContext GetContext(int srcW, int srcH, AutoGen.AVPixelFormat srcFormat, int dstW, int dstH, AutoGen.AVPixelFormat dstFormat, int flags) { AutoGen.SwsContext* swsCtx = FFmpegInvoke.sws_getContext(srcW, srcH, srcFormat, dstW, dstH, dstFormat, flags, null, null, null); if (swsCtx != null) { return new SWSContext(swsCtx); } return null; }
private void Create() => Execute(context => { var entity = new AutoGen(); Assert.Null(entity.Id); entity.Value = "X"; context.AutoGens.Add(entity); context.SaveChanges(); Assert.NotNull(entity.Id); });
private void Create() { var context = GetAutoGenDataContext(); var entity = new AutoGen(); Assert.IsNull(entity.Id); entity.Value = "X"; context.AutoGens.Add(entity); context.SaveChanges(); Assert.IsNotNull(entity.Id); }
public static AVMediaType ToWrapped(AutoGen.AVMediaType type) { switch (type) { case AutoGen.AVMediaType.AVMEDIA_TYPE_UNKNOWN: return AVMediaType.Unknown; case AutoGen.AVMediaType.AVMEDIA_TYPE_VIDEO: return AVMediaType.Video; case AutoGen.AVMediaType.AVMEDIA_TYPE_AUDIO: return AVMediaType.Audio; case AutoGen.AVMediaType.AVMEDIA_TYPE_DATA: return AVMediaType.Data; case AutoGen.AVMediaType.AVMEDIA_TYPE_SUBTITLE: return AVMediaType.Subtitle; case AutoGen.AVMediaType.AVMEDIA_TYPE_ATTACHMENT: return AVMediaType.Attachment; case AutoGen.AVMediaType.AVMEDIA_TYPE_NB: return AVMediaType.NB; default: throw new Exception("Unsupported AVMediaType "+type); } }
// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if ((_Event.Description == null) || (_Event.Description.Trim().Length == 0) || (_Event.Type <= 0)) { CreateStartDate = _Event.StartTime; UpdateViewData("Event Type and/or Event Description must be set."); return(Page()); } if (!ModelState.IsValid) { CreateStartDate = _Event.StartTime; UpdateViewData("One or more fields are not valid."); return(Page()); } if (_Event.ChurchId == -1) { _Event.ChurchId = null; } if (_Event.StartTime >= _Event.EndTime) { CreateStartDate = _Event.StartTime; UpdateViewData("End Date/Time must be later than Start Date/Time."); return(Page()); } UpdateAttendance(_Event.Id, _Event.Staff ?? 0, _Staff); _context.Event.Add(_Event); await _context.SaveChangesAsync(); // Generate any tasks based on events var autogen = new AutoGen(_context); return(RedirectToPage("./Index")); }
// To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://aka.ms/RazorPagesCRUD. public async Task <IActionResult> OnPostAsync() { if ((_Event.Description == null) || (_Event.Description.Trim().Length == 0) || (_Event.Type <= 0)) { UpdateViewData("Event Type and/or Event Description must be set."); return(Page()); } if (!ModelState.IsValid) { UpdateViewData("One or more fields are not valid."); return(Page()); } if (_Event.ChurchId == -1) { _Event.ChurchId = null; } if (_Event.StartTime >= _Event.EndTime) { UpdateViewData("End Date/Time must be later than Start Date/Time."); return(Page()); } // Check if Start or End Dates have changed and delete tasks associated with event and generate new ones. int NumTasksRemoved = RemoveChangedEventTasks(_context, _Event); UpdateAttendance(_Event.Id, _Event.Staff ?? 0, _Staff); _context.Attach(_Event).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EventExists(_Event.Id)) { return(NotFound()); } else { throw; } } if (NumTasksRemoved > 0) { // Regenerate tasks based on event now var autogen = new AutoGen(_context); autogen.GenTasks(_hostEnv); } if (string.IsNullOrEmpty(_RedirectURL)) { return(RedirectToPage("./Index")); } _RedirectURL = ""; return(NotFound()); }
private void AppendTracking(AutoGen.ItemShippingInformation item) { if (item.trackingdatalist == null) item.trackingdatalist = new AutoGen.TrackingData[] { }; AutoGen.TrackingData[] newList = new GCheckout.AutoGen.TrackingData[item.trackingdatalist.Length + 1]; if (item.trackingdatalist.Length > 0) { Array.Copy(item.trackingdatalist, 0, newList, 0, item.trackingdatalist.Length); } newList[newList.Length - 1] = _tracking; item.trackingdatalist = newList; }
/// <summary> /// Obtain the Merchant Codes from the OrderAdjustmentMerchantcodes. /// </summary> /// <param name="merchantcodes">The <seealso cref="AutoGen.OrderAdjustmentMerchantcodes"/></param> /// <returns></returns> public static List<MerchantCode> GetMerchantCodes(AutoGen.OrderAdjustmentMerchantcodes merchantcodes) { List<MerchantCode> retVal = new List<MerchantCode>(); if (merchantcodes == null) return retVal; foreach(object item in merchantcodes.Items) { if (item is AutoGen.CouponAdjustment) { AutoGen.CouponAdjustment adjust = item as AutoGen.CouponAdjustment; retVal.Add(new MerchantCode(adjust)); } if (item is AutoGen.GiftCertificateAdjustment) { AutoGen.GiftCertificateAdjustment adjust = item as AutoGen.GiftCertificateAdjustment; retVal.Add(new MerchantCode(adjust)); } } return retVal; }
public AVCodec(AutoGen.AVCodec* codec) { _codec = codec; }
/// <summary> /// Adds the country tax rule. /// This method adds a tax rule associated with a particular state. /// </summary> /// <param name="Area">The area.</param> /// <param name="TaxRate">The tax rate associated with a tax rule. Tax /// rates are expressed as decimal values. For example, a value of 0.0825 /// specifies a tax rate of 8.25%.</param> /// <param name="ShippingTaxed"> /// If this parameter has a value of <b>true</b>, then shipping costs will /// be taxed for items that use the associated tax rule. /// </param> /// <example> /// <code> /// // We assume Req is a CheckoutShoppingCartRequest object. /// // Charge the 50 states 8% tax and do not tax shipping. /// Req.AddCountryTaxRule(AutoGen.USAreas.FULL_50_STATES, 0.08, false); /// // Charge the 48 continental states 5% tax and do tax shipping. /// Req.AddCountryTaxRule(AutoGen.USAreas.CONTINENTAL_48, 0.05, true); /// // Charge all states (incl territories) 9% tax, don't tax shipping. /// Req.AddCountryTaxRule(AutoGen.USAreas.ALL, 0.09, false); /// </code> /// </example> public void AddCountryTaxRule(AutoGen.USAreas Area, double TaxRate, bool ShippingTaxed) { AutoGen.DefaultTaxRule Rule = new AutoGen.DefaultTaxRule(); Rule.rateSpecified = true; Rule.rate = TaxRate; Rule.shippingtaxedSpecified = true; Rule.shippingtaxed = ShippingTaxed; Rule.taxarea = new AutoGen.DefaultTaxRuleTaxarea(); AutoGen.USCountryArea ThisArea = new AutoGen.USCountryArea(); Rule.taxarea.Item = ThisArea; ThisArea.countryarea = Area; AddNewTaxRule(Rule); }
/// <summary> /// Obtain the Merchant Codes from the Order Notification. /// </summary> /// <param name="notification">The <seealso cref="AutoGen.NewOrderNotification"/></param> /// <returns></returns> public static List<MerchantCode> GetMerchantCodes(AutoGen.NewOrderNotification notification) { return GetMerchantCodes(notification.orderadjustment); }
public static bool Fill(AVPicture picture, SByteBuffer buffer, AutoGen.AVPixelFormat format, int width, int height) { return FFmpegInvoke.avpicture_fill(picture.NativeObj, buffer.NativeObj, format, width, height) == 0; }
public async Task <ActionResult> Submit(NewEntryBox model) { long _empId = (long)Session[Constants.SessionEmpID]; string _empName = Session[Constants.SessionEmpName].ToString(); List <string> emailStatus = new List <string>(); try { decimal edit1 = 0; decimal edit2 = 0; decimal edit3 = 0; model.Items[model.Items.Count - 1].InvolvementEditDays1 = 0; model.Items[model.Items.Count - 1].InvolvementEditDays2 = 0; model.Items[model.Items.Count - 1].InvolvementEditDays3 = 0; for (int i = 0; i < model.Items.Count - 1; i++) { edit1 = edit1 + model.Items[i].InvolvementEditDays1; edit2 = edit2 + model.Items[i].InvolvementEditDays2; edit3 = edit3 + model.Items[i].InvolvementEditDays3; } model.Items[model.Items.Count - 1].InvolvementEditDays1 = edit1; model.Items[model.Items.Count - 1].InvolvementEditDays2 = edit2; model.Items[model.Items.Count - 1].InvolvementEditDays3 = edit3; if (Convert.ToDouble(model.Items[model.Items.Count - 1].InvolvementDays1) < Convert.ToDouble(model.Items[model.Items.Count - 1].InvolvementEditDays1) || Convert.ToDouble(model.Items[model.Items.Count - 1].InvolvementDays2) < Convert.ToDouble(model.Items[model.Items.Count - 1].InvolvementEditDays2) || Convert.ToDouble(model.Items[model.Items.Count - 1].InvolvementDays3) < Convert.ToDouble(model.Items[model.Items.Count - 1].InvolvementEditDays3)) { ViewBag.ErrorMessage = "Total Input is more than allowable days, Please adjust your timesheet"; ViewBag.QuarterList = model.QID; ViewBag.QuarterList = DropdownList.PreviousAndQuarterList(_empId, true); return(View("Index", BindData(model.QID))); } if (model != null) { int roleId = Convert.ToInt32(Session[Constants.SessionRoleID]); foreach (BoxItems item in model.Items.Where(x => x.IsEdit1 || x.IsEdit2 || x.IsEdit3)) { if (item.ProjectID != 0) { int _currentNumber = 0; IQueryable <int> items = DB.EmpTimeSheet.OrderByDescending(u => u.SequenceNo).Take(1).Select(e => e.SequenceNo); foreach (int ir in items) { _currentNumber = ir; } if (_currentNumber == 0) { _currentNumber = 100; } else { _currentNumber++; } foreach (string month in months) { bool isEditable = false; NewEntryModel newEntryModel = new NewEntryModel(); newEntryModel.ApproveRejectStatus = roleId == 1 ? "A" : DB.ProjectEmployee.FirstOrDefault(x => x.EmployeeID == _empId && x.ProjectID == item.ProjectID).CheckRole == true ? "A" : null; if (month == months[0]) { newEntryModel.InvolveMonth = Convert.ToDateTime(model.Month1); newEntryModel.DaysCount = item.InvolvementDays1; newEntryModel.DaysEditCount = item.InvolvementEditDays1; newEntryModel.InvolvePercent = CalculateInvolvementPercentage(_empId, item.InvolvementEditDays1, newEntryModel); if (item.IsEdit1) { isEditable = true; } } if (month == months[1]) { newEntryModel.InvolveMonth = Convert.ToDateTime(model.Month2); newEntryModel.DaysCount = item.InvolvementDays2; newEntryModel.DaysEditCount = item.InvolvementEditDays2; newEntryModel.InvolvePercent = CalculateInvolvementPercentage(_empId, item.InvolvementEditDays2, newEntryModel); if (item.IsEdit2) { isEditable = true; } } if (month == months[2]) { newEntryModel.InvolveMonth = Convert.ToDateTime(model.Month3); newEntryModel.DaysCount = item.InvolvementDays3; newEntryModel.DaysEditCount = item.InvolvementEditDays3; newEntryModel.InvolvePercent = CalculateInvolvementPercentage(_empId, item.InvolvementEditDays3, newEntryModel); if (item.IsEdit3) { isEditable = true; } } if (newEntryModel.DaysCount != 0) { if (isEditable) { NewEntryModel exists = DB.EmpTimeSheet.FirstOrDefault(x => x.InvolveMonth == newEntryModel.InvolveMonth && x.EmpId == _empId && x.ProjectID == item.ProjectID); if (exists != null) { newEntryModel.TsID = exists.TsID; newEntryModel.RefNo = exists.RefNo; newEntryModel.SequenceNo = exists.SequenceNo; newEntryModel.EntryBy = _empId; //empid newEntryModel.EntryDate = DateTime.Now; newEntryModel.Quart = model.QID; newEntryModel.EntryRole = (long)Session[Constants.SessionRoleID]; newEntryModel.EmpId = _empId; //empid newEntryModel.ProjectID = item.ProjectID; newEntryModel.EmpRemarks = ""; newEntryModel.Status = newEntryModel.ApproveRejectStatus == "A" ? Convert.ToInt64(ReadConfig.GetValue("StatusApproved")) : Convert.ToInt64(ReadConfig.GetValue("StatusPending")); if (newEntryModel.ApproveRejectStatus == "A") { newEntryModel.ApproveRejectUser = _empId; } DB.Entry(exists).CurrentValues.SetValues(newEntryModel); } else { newEntryModel.RefNo = AutoGen.GetReferenceNumber(); newEntryModel.SequenceNo = _currentNumber; newEntryModel.EntryBy = _empId; //empid newEntryModel.EntryDate = DateTime.Now; newEntryModel.Quart = model.QID; newEntryModel.EntryRole = (long)Session[Constants.SessionRoleID]; newEntryModel.EmpId = _empId; //empid newEntryModel.ProjectID = item.ProjectID; newEntryModel.EmpRemarks = ""; newEntryModel.Status = newEntryModel.ApproveRejectStatus == "A" ? Convert.ToInt64(ReadConfig.GetValue("StatusApproved")) : Convert.ToInt64(ReadConfig.GetValue("StatusPending")); if (newEntryModel.ApproveRejectStatus == "A") { newEntryModel.ApproveRejectUser = _empId; } DB.EmpTimeSheet.Add(newEntryModel); } DB.SaveChanges(); if (newEntryModel.Status == Convert.ToInt64(ReadConfig.GetValue("StatusApproved"))) { TempData["Success"] = ResourceMessage.NewEntryApprove; } else if (newEntryModel.Status == Convert.ToInt64(ReadConfig.GetValue("StatusPending"))) { TempData["Success"] = ResourceMessage.NewEntrySubmit; } } } } if ((item.InvolvementDays1 > 0 && item.InvolvementEditDays1 > 0) || (item.InvolvementDays2 > 0 && item.InvolvementEditDays2 > 0) || (item.InvolvementDays3 > 0 && item.InvolvementEditDays3 > 0)) { var SubmittedMonths = new List <string>(); if (item.IsEdit1 && item.InvolvementEditDays1 > 0) { SubmittedMonths.Add(model.Month1); } if (item.IsEdit2 && item.InvolvementEditDays2 > 0) { SubmittedMonths.Add(model.Month2); } if (item.IsEdit3 && item.InvolvementEditDays3 > 0) { SubmittedMonths.Add(model.Month3); } if (roleId != 1) { bool isProjectManager = DB.ProjectEmployee.FirstOrDefault(x => x.ProjectID == item.ProjectID && x.EmployeeID == _empId).CheckRole; if (!isProjectManager) { string projectName = DB.ProjectMaster.FirstOrDefault(x => x.ProjectID == item.ProjectID).ProjectName; var projectManagers = (from x in DB.ProjectEmployee.Where(x => x.ProjectID == item.ProjectID && x.EmployeeID != _empId && x.CheckRole) join y in DB.Employee on x.EmployeeID equals y.EmployeeID join z in DB.User on y.UserID equals z.UserID select new { z.Email, y.EmpFirstName, y.EmpLastName, y.EmpMiddleName }).ToList <dynamic>(); if (SubmittedMonths.Any() && projectManagers.Any()) { bool emailResult = await Email.SendTimeSubmissionEmail(new TimeSheetSubmissionEmailModel() { EmpName = _empName, ManagerInfo = projectManagers, ProjectName = projectName, SubmissionDates = string.Join(", ", SubmittedMonths) }); if (!emailResult) { emailStatus.Add(projectName); } } } } } } } } } catch (Exception ex) { TempData["Error"] = ex.ToString(); LogHelper.ErrorLog(ex); } // TempData["EmailNotificationErrors"] = emailStatus; return(RedirectToAction("Index")); }
public AVPacket(AutoGen.AVPacket* packet) { _packet = packet; }
public static int GetSize(AutoGen.AVPixelFormat format, int width, int height) { return FFmpegInvoke.avpicture_get_size(format, width, height); }
public async Task <ActionResult> Editing_Update(DataSourceRequest request, NewEntryByProjectSelection[] MODEL) { ViewBag.ProjectList = DropdownList.ProjectList((long)Session[Constants.SessionEmpID], (long)(Session[Constants.SessionRoleID])); ViewBag.EmployeeList = DropdownList.EmployeeList(); ViewBag.Quadrent = GetQuardrent(); if (MODEL != null) { try { long _entryId = (long)Session[Constants.SessionEmpID]; string quarter = MODEL.Any() ? MODEL[0].Quarter : GetQuarter(); var listMonth = (from Quart in DB.Quarter where Quart.Quarter == quarter select new { Quart.Month }).ToList(); string month1 = DateTime.Now.ToString("yyyy/" + listMonth[0].Month + "/01"); string month2 = DateTime.Now.ToString("yyyy/" + listMonth[1].Month + "/01"); string month3 = DateTime.Now.ToString("yyyy/" + listMonth[2].Month + "/01"); int currentmonth = GetQuarter() == quarter ? DateTime.Now.Month : Convert.ToInt32(listMonth[2].Month); List <KeyValuePair <string, string> > emailStatus = new List <KeyValuePair <string, string> >(); if (MODEL != null && ModelState.IsValid) { foreach (NewEntryByProjectSelection product in MODEL) { int _currentNumber = 0; IQueryable <int> items = DB.EmpTimeSheet.OrderByDescending(u => u.SequenceNo).Take(1).Select(e => e.SequenceNo); foreach (int ir in items) { _currentNumber = ir; } if (_currentNumber == 0) { _currentNumber = 100; } else { _currentNumber++; } if (currentmonth == Convert.ToInt32(listMonth[0].Month)) { NewEntryModel newEntryModel = new NewEntryModel(); newEntryModel.InvolveMonth = Convert.ToDateTime(month1); newEntryModel.DaysCount = Convert.ToDecimal(product.InvolvementDays1); newEntryModel.DaysEditCount = Convert.ToDecimal(product.InvolvementEditDays1); newEntryModel.InvolvePercent = CalculateInvolvementPercentage(product.EmployeeID, product.InvolvementEditDays1, newEntryModel); NewEntryModel exists = DB.EmpTimeSheet.FirstOrDefault(x => x.InvolveMonth == newEntryModel.InvolveMonth && x.EmpId == product.EmployeeID && x.ProjectID == product.ProjectID); if (exists != null) { newEntryModel.TsID = exists.TsID; newEntryModel.RefNo = exists.RefNo; newEntryModel.SequenceNo = exists.SequenceNo; newEntryModel.EntryBy = (long)Session[Constants.SessionEmpID]; //empid newEntryModel.EntryDate = DateTime.Now; newEntryModel.Quart = quarter; newEntryModel.EntryRole = (long)Session[Constants.SessionRoleID]; newEntryModel.EmpId = product.EmployeeID; //empid newEntryModel.ProjectID = product.ProjectID; newEntryModel.EmpRemarks = ""; newEntryModel.ApproveRejectComments = ""; newEntryModel.ApproveRejectStatus = "A"; newEntryModel.ApproveRejectUser = (long)Session[Constants.SessionEmpID]; newEntryModel.ApproveRejectDate = DateTime.Now; newEntryModel.Status = Convert.ToInt64(ReadConfig.GetValue("StatusApproved")); DB.Entry(exists).CurrentValues.SetValues(newEntryModel); DB.SaveChanges(); } else { if (newEntryModel.DaysEditCount != 0 || product.IsEdit1) { newEntryModel.RefNo = AutoGen.GetReferenceNumber(); newEntryModel.SequenceNo = _currentNumber; newEntryModel.EntryBy = _entryId; //empid newEntryModel.EntryDate = DateTime.Now; newEntryModel.EntryRole = (long)Session[Constants.SessionRoleID]; newEntryModel.EmpId = product.EmployeeID; //empid newEntryModel.ProjectID = product.ProjectID; newEntryModel.Quart = quarter; newEntryModel.EmpRemarks = ""; newEntryModel.ApproveRejectComments = ""; newEntryModel.ApproveRejectStatus = "A"; newEntryModel.ApproveRejectUser = (long)Session[Constants.SessionEmpID]; newEntryModel.ApproveRejectDate = DateTime.Now; newEntryModel.Status = Convert.ToInt64(ReadConfig.GetValue("StatusApproved")); DB.EmpTimeSheet.Add(newEntryModel); DB.SaveChanges(); } } } if (currentmonth == Convert.ToInt32(listMonth[1].Month)) { foreach (string month in months) { NewEntryModel newEntryModel = new NewEntryModel(); bool isEdit = false; if (month == months[0]) { newEntryModel.InvolveMonth = Convert.ToDateTime(month1); newEntryModel.DaysCount = Convert.ToDecimal(product.InvolvementDays1); newEntryModel.DaysEditCount = Convert.ToDecimal(product.InvolvementEditDays1); newEntryModel.InvolvePercent = CalculateInvolvementPercentage(product.EmployeeID, product.InvolvementEditDays1, newEntryModel); isEdit = product.IsEdit1; } if (month == months[1]) { newEntryModel.InvolveMonth = Convert.ToDateTime(month2); newEntryModel.DaysCount = Convert.ToDecimal(product.InvolvementDays2); newEntryModel.DaysEditCount = Convert.ToDecimal(product.InvolvementEditDays2); newEntryModel.InvolvePercent = CalculateInvolvementPercentage(product.EmployeeID, product.InvolvementEditDays2, newEntryModel); isEdit = product.IsEdit2; } if (newEntryModel.DaysEditCount != 0 || isEdit) { NewEntryModel exists = DB.EmpTimeSheet.FirstOrDefault(x => x.InvolveMonth == newEntryModel.InvolveMonth && x.EmpId == product.EmployeeID && x.ProjectID == product.ProjectID); if (ModelState.IsValid) { if (exists != null) { newEntryModel.TsID = exists.TsID; newEntryModel.RefNo = exists.RefNo; newEntryModel.SequenceNo = exists.SequenceNo; newEntryModel.EntryBy = (long)Session[Constants.SessionEmpID]; //empid newEntryModel.EntryDate = DateTime.Now; newEntryModel.Quart = quarter; newEntryModel.EntryRole = (long)Session[Constants.SessionRoleID]; newEntryModel.EmpId = product.EmployeeID; //empid newEntryModel.ProjectID = product.ProjectID; newEntryModel.EmpRemarks = ""; newEntryModel.ApproveRejectComments = ""; newEntryModel.ApproveRejectStatus = "A"; newEntryModel.ApproveRejectUser = (long)Session[Constants.SessionEmpID]; newEntryModel.ApproveRejectDate = DateTime.Now; newEntryModel.Status = Convert.ToInt64(ReadConfig.GetValue("StatusApproved")); DB.Entry(exists).CurrentValues.SetValues(newEntryModel); DB.SaveChanges(); } else { newEntryModel.RefNo = AutoGen.GetReferenceNumber(); newEntryModel.SequenceNo = _currentNumber; newEntryModel.EntryBy = _entryId; //empid newEntryModel.EntryDate = DateTime.Now; newEntryModel.EntryRole = (long)Session[Constants.SessionRoleID]; newEntryModel.EmpId = product.EmployeeID; //empid newEntryModel.ProjectID = product.ProjectID; newEntryModel.Quart = quarter; newEntryModel.EmpRemarks = ""; newEntryModel.ApproveRejectComments = ""; newEntryModel.ApproveRejectStatus = "A"; newEntryModel.ApproveRejectUser = (long)Session[Constants.SessionEmpID]; newEntryModel.ApproveRejectDate = DateTime.Now; newEntryModel.Status = Convert.ToInt64(ReadConfig.GetValue("StatusApproved")); DB.EmpTimeSheet.Add(newEntryModel); DB.SaveChanges(); } } else { TempData["Error"] = ResourceMessage.DayscountExceed; //return View("Index", BindData(model.QID)); } } } } if (currentmonth == Convert.ToInt32(listMonth[2].Month)) { foreach (string month in months) { NewEntryModel newEntryModel = new NewEntryModel(); bool isEdit = false; if (month == months[0]) { newEntryModel.InvolveMonth = Convert.ToDateTime(month1); newEntryModel.DaysCount = Convert.ToDecimal(product.InvolvementDays1); newEntryModel.DaysEditCount = Convert.ToDecimal(product.InvolvementEditDays1); newEntryModel.InvolvePercent = CalculateInvolvementPercentage(product.EmployeeID, product.InvolvementEditDays1, newEntryModel); isEdit = product.IsEdit1; } if (month == months[1]) { newEntryModel.InvolveMonth = Convert.ToDateTime(month2); newEntryModel.DaysCount = Convert.ToDecimal(product.InvolvementDays2); newEntryModel.DaysEditCount = Convert.ToDecimal(product.InvolvementEditDays2); newEntryModel.InvolvePercent = CalculateInvolvementPercentage(product.EmployeeID, product.InvolvementEditDays2, newEntryModel); isEdit = product.IsEdit2; } if (month == months[2]) { newEntryModel.InvolveMonth = Convert.ToDateTime(month3); newEntryModel.DaysCount = Convert.ToDecimal(product.InvolvementDays3); newEntryModel.DaysEditCount = Convert.ToDecimal(product.InvolvementEditDays3); newEntryModel.InvolvePercent = CalculateInvolvementPercentage(product.EmployeeID, product.InvolvementEditDays3, newEntryModel); isEdit = product.IsEdit3; } if (newEntryModel.DaysEditCount != 0 || isEdit) { NewEntryModel exists = DB.EmpTimeSheet.FirstOrDefault(x => x.InvolveMonth == newEntryModel.InvolveMonth && x.EmpId == product.EmployeeID && x.ProjectID == product.ProjectID); if (ModelState.IsValid) { if (exists != null) { newEntryModel.TsID = exists.TsID; newEntryModel.RefNo = exists.RefNo; newEntryModel.SequenceNo = exists.SequenceNo; newEntryModel.EntryBy = (long)Session[Constants.SessionEmpID]; //empid newEntryModel.EntryDate = DateTime.Now; newEntryModel.Quart = quarter; newEntryModel.EntryRole = (long)Session[Constants.SessionRoleID]; newEntryModel.EmpId = product.EmployeeID; //empid newEntryModel.ProjectID = product.ProjectID; newEntryModel.EmpRemarks = ""; newEntryModel.ApproveRejectComments = ""; newEntryModel.ApproveRejectStatus = "A"; newEntryModel.ApproveRejectUser = (long)Session[Constants.SessionEmpID]; newEntryModel.ApproveRejectDate = DateTime.Now; newEntryModel.Status = Convert.ToInt64(ReadConfig.GetValue("StatusApproved")); DB.Entry(exists).CurrentValues.SetValues(newEntryModel); DB.SaveChanges(); } else { newEntryModel.RefNo = AutoGen.GetReferenceNumber(); newEntryModel.SequenceNo = _currentNumber; newEntryModel.EntryBy = _entryId; //empid newEntryModel.EntryDate = DateTime.Now; newEntryModel.EntryRole = (long)Session[Constants.SessionRoleID]; newEntryModel.EmpId = product.EmployeeID; //empid newEntryModel.ProjectID = product.ProjectID; newEntryModel.Quart = quarter; newEntryModel.EmpRemarks = ""; newEntryModel.ApproveRejectComments = ""; newEntryModel.ApproveRejectStatus = "A"; newEntryModel.ApproveRejectUser = (long)Session[Constants.SessionEmpID]; newEntryModel.ApproveRejectDate = DateTime.Now; newEntryModel.Status = Convert.ToInt64(ReadConfig.GetValue("StatusApproved")); DB.EmpTimeSheet.Add(newEntryModel); DB.SaveChanges(); } } else { TempData["Error"] = ResourceMessage.DayscountExceed; //return View("Index", BindData(model.QID)); } } } } if ((product.IsEdit1 && product.InvolvementEditDays1 > 0) || (product.IsEdit2 && product.InvolvementEditDays2 > 0) || (product.IsEdit3 && product.InvolvementEditDays3 > 0)) { var SubmittedMonths = new List <string>(); if (product.IsEdit1 && product.InvolvementEditDays1 > 0) { SubmittedMonths.Add(product.Month1 + " " + Convert.ToDateTime(month1).Year); } if (product.IsEdit2 && product.InvolvementEditDays2 > 0) { SubmittedMonths.Add(product.Month2 + " " + Convert.ToDateTime(month2).Year); } if (product.IsEdit3 && product.InvolvementEditDays3 > 0) { SubmittedMonths.Add(product.Month3 + " " + Convert.ToDateTime(month3).Year); } string projectName = DB.ProjectMaster.FirstOrDefault(x => x.ProjectID == product.ProjectID).ProjectName; var projectManagers = (from x in DB.ProjectEmployee.Where(x => x.ProjectID == product.ProjectID && x.EmployeeID != product.EmployeeID && x.CheckRole) join y in DB.Employee on x.EmployeeID equals y.EmployeeID join z in DB.User on y.UserID equals z.UserID select new { z.Email, y.EmpFirstName, y.EmpLastName, y.EmpMiddleName }).ToList <dynamic>(); if (SubmittedMonths.Any() && projectManagers.Any()) { var emp = DB.Employee.FirstOrDefault(x => x.EmployeeID == product.EmployeeID); var emailObj = new TimeSheetSubmissionEmailModel() { EmpName = Models.Common.GetName(emp.EmpFirstName, emp.EmpLastName, emp.EmpMiddleName), ManagerInfo = projectManagers, ProjectName = projectName, SubmissionDates = string.Join(", ", SubmittedMonths) }; bool emailResult = await Email.SendTimeSubmissionEmail(emailObj); if (!emailResult) { emailStatus.Add(new KeyValuePair <string, string>(emailObj.EmpName, projectName)); } } } } } return(Json(new { MODEL, emailStatus })); } catch (Exception ex) { LogHelper.ErrorLog(ex); throw ex; } } else { ViewBag.Quadrent = GetQuardrent(); long empId = (long)Session[Constants.SessionEmpID]; ViewBag.QuarterList = DropdownList.PreviousAndQuarterListNewEntryOnBehalf(empId); NewEntryByProjectSelection model = new NewEntryByProjectSelection { Quarter = ViewBag.Quadrent, Month1 = "Jan-2019" }; return(View("Index", model)); } }
public AVFormatContext(AutoGen.AVFormatContext* formatContext) { _formatContext = formatContext; }
public SWSContext(AutoGen.SwsContext* context) { _context = context; }
internal Subscription(AutoGen.Subscription subscription) { if (subscription == null) throw new ArgumentNullException("subscription"); if (subscription.nochargeafterSpecified) this.NoChargeAfter = subscription.nochargeafter; if (subscription.payments != null) { foreach (AutoGen.SubscriptionPayment item in subscription.payments) { this.Payments.Add(new SubscriptionPayment(item)); } } this.Period = subscription.period; this.RecurrentItem = new ShoppingCartItem(subscription.recurrentitem); this.StartDate = subscription.startdate; this.Type = (SubscriptionType)Enum.Parse(typeof(SubscriptionType), subscription.type, true); }
public AVFrame(AutoGen.AVFrame* frame) { _frame = frame; }
/// <summary> /// This method adds a new tax rule to the <default-tax-table>. /// This method is called by the methods that create the XML blocks /// for flat-rate shipping, merchant-calculated shipping and instore-pickup /// shipping methods. /// </summary> /// <param name="NewRule">This parameter contains an object representing /// a default tax rule.</param> private void AddNewTaxRule(AutoGen.DefaultTaxRule NewRule) { var rules = new List<AutoGen.DefaultTaxRule>(); if (_TaxTables.defaulttaxtable.taxrules != null && _TaxTables.defaulttaxtable.taxrules.Length > 0) { rules.AddRange(_TaxTables.defaulttaxtable.taxrules); } rules.Add(NewRule); //Always create the array, even if it is empty. _TaxTables.defaulttaxtable.taxrules = rules.ToArray(); }
/// <summary> /// Adds the country tax rule. /// This method adds a tax rule associated with a particular state. /// </summary> /// <param name="Area">The area.</param> /// <param name="TaxRate">The tax rate associated with a tax rule. Tax /// rates are expressed as decimal values. For example, a value of 0.0825 /// specifies a tax rate of 8.25%.</param> /// <example> /// <code> /// // We assume Req is a CheckoutShoppingCartRequest object. /// // Charge the 50 states 8% tax. /// Req.AddCountryTaxRule(AutoGen.USAreas.FULL_50_STATES, 0.08); /// // Charge the 48 continental states 5% tax. /// Req.AddCountryTaxRule(AutoGen.USAreas.CONTINENTAL_48, 0.05); /// // Charge all states (incl territories) 9% tax. /// Req.AddCountryTaxRule(AutoGen.USAreas.ALL, 0.09); /// </code> /// </example> public void AddCountryTaxRule(AutoGen.USAreas Area, double TaxRate) { AutoGen.AlternateTaxRule rule = new AutoGen.AlternateTaxRule(); rule.rateSpecified = true; rule.rate = TaxRate; rule.taxarea = new AutoGen.AlternateTaxRuleTaxarea(); AutoGen.USCountryArea ThisArea = new AutoGen.USCountryArea(); rule.taxarea.Item = ThisArea; ThisArea.countryarea = Area; _taxRules.Add(rule); }
public AVCodecContext(AutoGen.AVCodecContext* codecContext) { _codecContext = codecContext; }
public async Task DoWork(CancellationToken stoppingToken) { while (!stoppingToken.IsCancellationRequested) { DateTime enow = PropMgr.ESTNow; DateTime expected = new DateTime(enow.Year, enow.Month, enow.Day, 3, 0, 0); DateTime lastW = (_csSettings.LastTaskUpdate != null) ? _csSettings.LastTaskUpdate : new DateTime(2020, 1, 1); #if DEBUG double MinWait = 0; // for testing #else double MinWait = 720; // 12 hrs #endif if (((enow - lastW).TotalMinutes >= MinWait) || (Math.Abs((enow - expected).TotalMinutes) < 65)) // done not more than twice a day and covers DST change with delay/offset { // Check Stock for possibly needed items OrderedEvents ordEvs = new OrderedEvents(_context); IList <InventoryItem> InventoryItems = _context.InventoryItem.Include(i => i.Inventory).Include(i => i.Item).ToList(); foreach (var invIt in InventoryItems) { if (IndexInvModel.MayNeedItem(_context, invIt, ordEvs)) { // Item likely needs to be ordered. Mark as needed. if (invIt.State == IndexInvModel.STOCKED_STATE) { invIt.State = IndexInvModel.NEEDED_STATE; _context.Attach(invIt).State = EntityState.Modified; try { _context.SaveChanges(); _csSettings.LastStockUpdate = PropMgr.ESTNow; _csSettings.Save(); await Task.Run(() => IndexInvModel.NotifyNeedAsync(_hostEnv, _configuration, _userManager, "CStat:Stock> Needed : " + invIt.Item.Name, true)); // potentially clean Message log } catch (DbUpdateConcurrencyException) { continue; } } } } // Check for new Tasks AutoGen ag = new AutoGen(_context); _csSettings.LastTaskUpdate = PropMgr.ESTNow; _csSettings.Save(); ag.GenTasks(_hostEnv); // Notify users Tasks Due CTask.NotifyUserTaskDue(_hostEnv, _configuration, _userManager, _context, 24, true); // Potentially clean log // Persist Daily Reading and Notify if needed for Propane PropaneMgr pmgr = new PropaneMgr(_hostEnv, _configuration, _userManager); pmgr.CheckValue(pmgr.GetTUTank(true)); // get value, log to file and check // Check for any unexpected propane usage (not potentially impacted from events) from recent daily usage var plList = pmgr.GetAll(3); var plCnt = plList.Count; if (plCnt > 1) { for (int i = 0; i < plCnt - 1; ++i) { var plStart = plList[i]; var plEnd = plList[i + 1]; var dateRange = new DateRange(plStart.ReadingTime, plEnd.ReadingTime); var evList = ag.GetImpactingEvents(dateRange); if (evList.Count == 0) // no impacting events { var totalHrs = dateRange.TotalHours(); if ((totalHrs > 0) && _csSettings.GetPropaneProperties(out double tankGals, out double pricePerGal)) { var totalGals = ((plStart.LevelPct - plEnd.LevelPct) / 100) * tankGals; if ((totalGals / totalHrs) > ((double)2 / 24)) // averaging more than 2 gals/day? { // Send a one time alert (allowResend = false) CSSMS sms = new CSSMS(_hostEnv, _configuration, _userManager); sms.NotifyUsers(CSSMS.NotifyType.EquipNT, "CStat:Equip> " + "Non Event Propane Usage was " + totalGals.ToString("0.##") + " gals. during " + totalHrs.ToString("0.#") + " hours starting " + plStart.ReadingTime.Month + "/" + plStart.ReadingTime.Day + "/" + plStart.ReadingTime.Year % 100, false, true); // potentially clean Message Log } } } } } // Check for new EMails to store CSEMail.SaveEMails(_configuration, _userManager); // Check/Truncate Size of Arduino file ArdMgr amgr = new ArdMgr(_hostEnv, _configuration, _userManager); amgr.GetAll(true); // Clean/{Reset to full view} Camera using (var ptz = new PtzCamera()) { ptz.Cleanup(_hostEnv); } _logger.LogInformation($"CStat Daily Updates Completed at {PropMgr.ESTNow}"); } // Run again at 3:00 AM DateTime now = PropMgr.ESTNow; DateTime tom = now.AddDays(1); DateTime start = new DateTime(tom.Year, tom.Month, tom.Day, 3, 0, 0); // Restart at 3:00 AM tomorrow int MSecsToStart = (int)Math.Round((start - now).TotalMilliseconds); await System.Threading.Tasks.Task.Delay(MSecsToStart, stoppingToken); } }
/// <summary> /// Obtain the Merchant Codes from the Order Adjustment. /// </summary> /// <param name="adjustment">The <seealso cref="AutoGen.OrderAdjustment"/></param> /// <returns></returns> public static List<MerchantCode> GetMerchantCodes(AutoGen.OrderAdjustment adjustment) { if (adjustment == null) return new List<MerchantCode>(); return GetMerchantCodes(adjustment.merchantcodes); }
/// <summary> /// This method adds a new tax rule to the <default-tax-table>. /// This method is called by the methods that create the XML blocks /// for flat-rate shipping, merchant-calculated shipping and instore-pickup /// shipping methods. /// </summary> /// <param name="NewRule">This parameter contains an object representing /// a default tax rule.</param> private void AddNewTaxRule(AutoGen.DefaultTaxRule NewRule) { AutoGen.DefaultTaxTable NewTable = new AutoGen.DefaultTaxTable(); NewTable.taxrules = new AutoGen.DefaultTaxRule [_TaxTables.defaulttaxtable.taxrules.Length + 1]; for (int i = 0; i < NewTable.taxrules.Length - 1; i++) { NewTable.taxrules[i] = _TaxTables.defaulttaxtable.taxrules[i]; } NewTable.taxrules[NewTable.taxrules.Length - 1] = NewRule; _TaxTables.defaulttaxtable = NewTable; }
public AVPicture(AutoGen.AVPicture* picture) { _picture = picture; }
/// <summary> /// This method adds an allowed U.S. country area to a /// <us-country-area> element. The <us-country-area> element, /// in turn, appears as a subelement of <allowed-areas>. /// </summary> /// <param name="CountryArea">The country area.</param> public void AddAllowedCountryArea(AutoGen.USAreas CountryArea) { AutoGen.USCountryArea NewArea = new AutoGen.USCountryArea(); NewArea.countryarea = CountryArea; AddNewAllowedArea(NewArea); }