public Smsc BuildFromRow(DataRow row) { var returnRecord = Smsc.BuildSmscFromRow(row); returnRecord = this.BuildExtraFromRow <Smsc>(returnRecord, row); return(returnRecord); }
public Smsc Insert(Smsc record) { DataRow row = this.dataSet.ttblsmsc.NewttblsmscRow(); this.UpdateToRow(ref row, record); this.ExtraUpdateToRow(ref row, record); this.dataSet.ttblsmsc.AddttblsmscRow((pdssmscDataSet.ttblsmscRow)row); this.SaveChanges(); return(this.dataSet.ttblsmsc.Rows.Count > 0 ? this.BuildFromRow(this.dataSet.ttblsmsc.Rows[0]) : null); }
public Smsc GetByRowId(string rowId, string fldList) { var row = this.GetRowByRowId(rowId, fldList); Smsc smsc = null; if (row != null) { smsc = this.BuildFromRow(row); } return(smsc); }
protected Smsc Fetch(string where, int batchsize, string fldList) { this.FetchWhere(where, batchsize, fldList); var row = this.dataSet.ttblsmsc.AsEnumerable().SingleOrDefault(); Smsc smsc = null; if (row != null) { smsc = this.BuildFromRow(row); } return(smsc); }
public void Delete(Smsc record) { var row = this.GetRowByRowId(record.rowID, string.Empty); if (row == null) { row = this.dataSet.ttblsmsc.NewttblsmscRow(); Smsc.BuildMinimalRow(ref row, record); this.dataSet.ttblsmsc.AddttblsmscRow((pdssmscDataSet.ttblsmscRow)row); } row.Delete(); this.SaveChanges(); }
public Smsc Update(Smsc record) { var row = this.GetRowByRowId(record.rowID, string.Empty); if (row != null) { this.UpdateToRow(ref row, record); this.ExtraUpdateToRow(ref row, record); this.SaveChanges(); return(this.dataSet.ttblsmsc.Rows.Count > 0 ? this.BuildFromRow(this.dataSet.ttblsmsc.Rows[0]) : null); } ErrorReportingHelper.ReportErrors("global.update.doesnotexist", 421); return(null); }
/// <summary> /// Отправляет код на номер телефона в SMS. /// </summary> /// <param name="mobilePhone"></param> /// <param name="code"></param> public static void SendCode(string mobilePhone, string code) { //DebugActivationCodeStore[mobilePhone] = code; //debug var messageTemplate = Umbraco.Core.Dictionary.CultureDictionaryFactoryResolver.Current.Factory.CreateDictionary()["[forms][sgup]CodeSmsTemplate"]; var smsText = messageTemplate.NamedFormat(new { code = code }); var smsc = new Smsc { Msisdn = mobilePhone, Text = smsText }; smsc.AddSmsToQueue(); }
public void UpdateToRow(ref DataRow row, Smsc record) { Smsc.UpdateRowFromSmsc(ref row, record); this.ExtraUpdateToRow(ref row, record); }
public void Delete(Smsc record) { this.repository.Delete(record); }
public Smsc Insert(Smsc record) { return(this.repository.Insert(record)); }
public Smsc Update(Smsc record) { return(this.repository.Update(record)); }
public void Delete(Smsc record) { this.adapter.Delete(record); }
public Smsc Update(Smsc record) { return(this.adapter.Update(record)); }
public Smsc Insert(Smsc record) { return(this.adapter.Insert(record)); }
public void UpdateOrder(int orderId, int managerId, int statusId, int discount) { int? newManagerId; char newStatus; int newDiscount; IUser newManagerUser = null; if (managerId == 0) { newManagerUser = null; newManagerId = null; } else { newManagerUser = ApplicationContext.Current.Services.UserService.GetUserById(managerId); if (newManagerUser == null || newManagerUser.UserType.Alias != MANAGER_USER_TYPE_ALIAS) { throw new Exception("Не найден менеджер с ID " + managerId + "."); } newManagerId = managerId; } if (discount >= 0 && discount <= 100) { newDiscount = discount; } else { newDiscount = 0; } IPublishedContent newStatusNode; if (statusId == 0) { newStatus = '?'; newStatusNode = null; } else { var status = OrderModel.StatusCache.FirstOrDefault(x => x.Value.Id == statusId); if (status.Key == 0) { throw new Exception("Не найден заказ с ID " + statusId + "."); } newStatus = status.Key; newStatusNode = status.Value; } var db = ApplicationContext.Current.DatabaseContext.Database; var orderDto = db.Single<OrderDto>(orderId); if (orderDto.ManagerId != newManagerId && managerId != 0) { //отправка уведомления заказчику о смене менеджера try { if (!orderDto.CustomerId.HasValue) { throw new Exception("Не указан ID заказчика."); } var customerMember = ApplicationContext.Services.MemberService.GetById(orderDto.CustomerId.Value); if (customerMember == null) { throw new Exception("Не найден участник с ID " + orderDto.CustomerId.Value + "."); } var mobilePhone = customerMember.GetValue<string>("mobilePhone"); var text = Umbraco.GetDictionaryValue("[ord]ManagerChangeCustSms").NamedFormat(new { ordId = orderId, manager = newManagerUser.Name }); var smsc = new Smsc { Msisdn = mobilePhone, Text = text }; smsc.AddSmsToQueue(); } catch (Exception e) { global::Umbraco.Core.Logging.LogHelper.Error(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "Ошибка отправки SMS-уведомления заказчику о смене менеджера заказа с ID " + orderId + ".", e); } //отправка менеджеру уведомления о его назначении на данный заказ try { var mailer = new Mailer { Subject = Umbraco.GetDictionaryValue("[ord]ManagerChangeManSubject"), Body = Umbraco.GetDictionaryValue("[ord]ManagerChangeManBody").NamedFormat(new { orderId = orderId }), IsBodyHtml = false }; mailer.AddTo(newManagerUser.Email).Send(); } catch (Exception e) { global::Umbraco.Core.Logging.LogHelper.Error(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "Ошибка отправки почтового уведомления менеджеру о его назначении на заказ с ID " + orderId + ".", e); } } if (orderDto.Status != newStatus && statusId != 0) { //отправка SMS-уведомления заказчику о смене статуса заказа try { if (!orderDto.CustomerId.HasValue) { throw new Exception("Не указан ID заказчика."); } var customerMember = ApplicationContext.Services.MemberService.GetById(orderDto.CustomerId.Value); if (customerMember == null) { throw new Exception("Не найден участник с ID " + orderDto.CustomerId.Value + "."); } var mobilePhone = customerMember.GetValue<string>("mobilePhone"); var text = Umbraco.GetDictionaryValue("[ord]OrderStatusChangeCustSms").NamedFormat(new { orderId = orderId, status = newStatusNode.Name }); var smsc = new Smsc { Msisdn = mobilePhone, Text = text }; smsc.AddSmsToQueue(); } catch (Exception e) { global::Umbraco.Core.Logging.LogHelper.Error(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType, "Ошибка отправки SMS-уведомления заказчику о смене статуса заказа с ID " + orderId + ".", e); } } orderDto.ManagerId = newManagerId; orderDto.Discount = newDiscount; orderDto.Status = newStatus; db.Update(orderDto); }