public void UpdateDatosEmpleado2(UsuarioEntidad usuario) { ValidationUtility.ValidateArgument("usuario", usuario); SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@IdUsuario", usuario.IdUsuario), new SqlParameter("@Nombre", usuario.Nombre), new SqlParameter("@Apellido", usuario.Apellido), new SqlParameter("@NumeroDocumento", usuario.NumeroDocumento), // new SqlParameter("@IdTipoUsuario", usuario.MiUsuario.IdTipoUsuario ), new SqlParameter("@IdSexo", usuario.MiSexo.IdSexo), new SqlParameter("@Email", usuario.Email), new SqlParameter("@NumeroTelefono", usuario.NumeroTelefono), new SqlParameter("@DVH", usuario.DVH) }; SqlClientUtility.ExecuteScalar(SqlClientUtility.connectionStringName, CommandType.StoredProcedure, "UpdateDatosEmpleado2", parameters); // var Resultado =(decimal) //int IdUsuarioRes = Decimal.ToInt32(Resultado); //usuario.IdUsuario = IdUsuarioRes; }
/// <summary> /// Saves a record to the sol_Orders table. /// </summary> public virtual void Insert(Sol_Order sol_Order) { ValidationUtility.ValidateArgument("sol_Order", sol_Order); SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@OrderType", sol_Order.OrderType), new SqlParameter("@WorkStationID", sol_Order.WorkStationID), new SqlParameter("@ComputerName", sol_Order.ComputerName), new SqlParameter("@UserID", sol_Order.UserID), new SqlParameter("@UserName", sol_Order.UserName), new SqlParameter("@Date", sol_Order.Date), new SqlParameter("@CashTrayID", sol_Order.CashTrayID), new SqlParameter("@CustomerID", sol_Order.CustomerID), new SqlParameter("@Name", sol_Order.Name), new SqlParameter("@Address1", sol_Order.Address1), new SqlParameter("@Address2", sol_Order.Address2), new SqlParameter("@City", sol_Order.City), new SqlParameter("@Province", sol_Order.Province), new SqlParameter("@Country", sol_Order.Country), new SqlParameter("@PostalCode", sol_Order.PostalCode), new SqlParameter("@TotalAmount", sol_Order.TotalAmount), new SqlParameter("@DateClosed", sol_Order.DateClosed), new SqlParameter("@DatePaid", sol_Order.DatePaid), new SqlParameter("@FeeID", sol_Order.FeeID), new SqlParameter("@FeeAmount", sol_Order.FeeAmount), new SqlParameter("@Tax1Amount", sol_Order.Tax1Amount), new SqlParameter("@Tax2Amount", sol_Order.Tax2Amount), new SqlParameter("@Status", sol_Order.Status), new SqlParameter("@Reference", sol_Order.Reference), new SqlParameter("@PaymentTypeID", sol_Order.PaymentTypeID), //new SqlParameter("@SecurityCode", sol_Order.SecurityCode), new SqlParameter("@Comments", sol_Order.Comments) // , //new SqlParameter("@IsNew", sol_Order.IsNew) }; sol_Order.OrderID = (int)SqlClientUtility.ExecuteScalar(connectionStringName, CommandType.StoredProcedure, "sol_Orders_Insert", parameters); }
/// <summary> /// Updates a record in the XE table. /// </summary> public void Update(XE_DTO Xe) { ValidationUtility.ValidateArgument("Xe", Xe); SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@MA", Xe.Ma), new SqlParameter("@TEN_XE", Xe.TenXe), new SqlParameter("@MA_KIEU_XE", Xe.MaKieuXe), new SqlParameter("@MA_HANG_XE", Xe.MaHangXe), new SqlParameter("@DOI_XE", Xe.DoiXe), new SqlParameter("@CHI_SO_NHIEN_LIEU", Xe.ChiSoNhienLieu), new SqlParameter("@MAX_SPEED", Xe.MaxSpeed), new SqlParameter("@LOAI_DIA_HINH", Xe.LoaiDiaHinh), new SqlParameter("@SO_CHO_NGOI", Xe.SoChoNgoi), new SqlParameter("@GIA_TIEN_BAN", Xe.GiaTienBan), new SqlParameter("@GIA_TIEN_MUA", Xe.GiaTienMua), new SqlParameter("@SO_LUONG", Xe.SoLuong) }; SqlClientUtility.ExecuteNonQuery(m_ConnectionString, CommandType.StoredProcedure, "PROC_Xe_Update", parameters); }
protected void DetailsViewBankslipItem_ItemDeleted(object sender, DetailsViewDeletedEventArgs e) { if (e.Exception != null) { e.ExceptionHandled = true; ValidationUtility.ShowValidationErrors(this, e.Exception); } else { int bankslipID = GXGridView1SelectedValue; GXGridViewBankslipItems.TotalRecords = ViewBankslipItem.SelectByFKCountCached("BankslipID", bankslipID); GXGridViewBankslipItems.DataBind(); mvBankslipItems.SetActiveView(viewBankslipGrid); Bankslip bk = Bankslip.Get(GXGridView1SelectedValue); decimal debtValue = Convert.ToDecimal(e.Values["DebtValue"]); decimal demandValue = Convert.ToDecimal(e.Values["DemandValue"]); bk.DebtValue -= debtValue; bk.DemandValue -= demandValue; Bankslip.Table.Context.SubmitChanges(); dvBankslipForItem.DataBind(); } }
public BusinessObject <EntityBase> GetByID(int id) { ValidationUtility.ThrowIfLessThan(id, 1, "id"); // Example: http://api.themoviedb.org/3/movie/1858?api_key=c78b66672025d9b8a5fcb54a07c6ad84 var entity = new BusinessObject <EntityBase>(); var result = this.GetData("http://api.themoviedb.org/3/movie/{1}?api_key={0}", id.ToString()); if (result.Errors.IsNullOrEmpty()) { if (result.Data != null) { entity.Data = this.MapToMovie(result.Data); } } else { entity.Errors.AddRange(result.Errors); } return(entity); }
/// <summary> /// Updates a record in the Qds_Bag table. /// </summary> public virtual void Update(Qds_Bag qds_Bag) { ValidationUtility.ValidateArgument("qds_Bag", qds_Bag); SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@BagID", qds_Bag.BagID), new SqlParameter("@DropID", qds_Bag.DropID), new SqlParameter("@BagEstimateUnderLitre", qds_Bag.BagEstimateUnderLitre), new SqlParameter("@BagEstimateOverLitre", qds_Bag.BagEstimateOverLitre), new SqlParameter("@DateEntered", qds_Bag.DateEntered), new SqlParameter("@DateAccepted", qds_Bag.DateAccepted), new SqlParameter("@DateCounted", qds_Bag.DateCounted), new SqlParameter("@DatePaid", qds_Bag.DatePaid), new SqlParameter("@DepotID", qds_Bag.DepotID), new SqlParameter("@DatePrinted", qds_Bag.DatePrinted) //, //new SqlParameter("@IsNew", qds_Bag.IsNew) }; SqlClientUtility.ExecuteNonQuery(connectionStringName, CommandType.StoredProcedure, "Qds_Bag_Update", parameters); }
private void btnSave_Click(object sender, EventArgs e) { if (ValidationUtility.FieldNotAllowNull(this) == false) { return; } IList <QuotationDetail> lstProduct = gridControl1.DataSource as IList <QuotationDetail>; if (m_Po == null) { return; } if (lstProduct == null) { return; } CoverObjectUtility.GetAutoBindingData(this.tableLayoutPanel3, m_Po); try { using (IUnitOfWork uow = new UnitOfWork()) { uow.PoRepository.Add(m_Po); uow.Commit(); } isEdited = false; lblNotify1.SetText(UI.createsuccess, ToolBoxCS.LabelNotify.EnumStatus.Success); if (AddRow != null) { m_Po.Quantity = Convert.ToInt32(colQuantity.SummaryText); m_Po.TotalValue = CurrencyUtility.ToDecimal(colThanhtien.SummaryText); AddRow(m_Po, CRUD.Insert); } Close(); } catch { lblNotify1.SetText(UI.createfailed, ToolBoxCS.LabelNotify.EnumStatus.Failed); } }
private void btnSave_Click(object sender, EventArgs e) { if (m_Po.ApproveStatusId == (int)ApproveStatus.Approved) { lblNotify1.SetText(UI.itemwasapproved, ToolBoxCS.LabelNotify.EnumStatus.Failed, 5000); return; } if (ValidationUtility.FieldNotAllowNull(this.tableLayoutPanel3) == false) { return; } if (m_Po == null) { return; } CoverObjectUtility.GetAutoBindingData(this.tableLayoutPanel3, m_Po); m_Po.Quantity = Convert.ToInt32(colQuantity.SummaryText); m_Po.TotalValue = CurrencyUtility.ToDecimal(colThanhtien.SummaryText); m_Po.SetModify(); try { using (IUnitOfWork uow = new UnitOfWork()) { uow.PoRepository.Update(m_Po); uow.Commit(); } lblNotify1.SetText(UI.updatesuccess, ToolBoxCS.LabelNotify.EnumStatus.Success); isEdited = false; if (UpdateRow != null) { UpdateRow(m_Po, CRUD.Update); } } catch { lblNotify1.SetText(UI.updatefailed, ToolBoxCS.LabelNotify.EnumStatus.Failed); } }
private void btnSaveDeputy_Click(object sender, EventArgs e) { if (ValidationUtility.FieldNotAllowNull(groupBox1) == false) { lblNotify1.SetText(UI.hasnoinfomation, LabelNotify.EnumStatus.Failed); return; } if (m_User == null) { return; } CoverObjectUtility.GetAutoBindingData(groupBox1, m_User); if (m_User == null) { return; } try { if (SaveAccount(m_User) == null) { return; } if (!string.IsNullOrWhiteSpace(ptbSignature.PictureOriginPath)) { PictureUtility.SaveImg(ptbSignature.PictureOriginPath); } if (!string.IsNullOrWhiteSpace(ptbAvatar.PictureOriginPath)) { PictureUtility.SaveImg(ptbAvatar.PictureOriginPath); } gridUtility1.UpdateRow <Deputy>(m_Deputy); lblNotify1.SetText(UI.success, LabelNotify.EnumStatus.Success); } catch { lblNotify1.SetText(UI.failed, LabelNotify.EnumStatus.Failed); } }
private void btnSave_Click(object sender, EventArgs e) { if (ValidationUtility.FieldNotAllowNull(this) == false) { return; } ProductLine line = new ProductLine(); line.SerieId = m_Serie.SerieId; CoverObjectUtility.GetAutoBindingData(this, line); try { using (IUnitOfWork uow = new UnitOfWork()) { uow.ProductLineRepository.Add(line); uow.Commit(); } TreeTag tag = new TreeTag(); tag.CateId = m_Category.CategoryId; tag.CateName = m_Category.CategoryName; tag.SerieId = m_Serie.SerieId; tag.SerieName = m_Serie.SerieName; tag.LineId = line.ProductLineId; tag.LineName = line.ProductLineName; tag.NodeTye = TreeTag.Types.Line; TreeNode node = new TreeNode(line.ProductLineName); node.Tag = tag; if (AddNode != null) { AddNode(node); } this.Close(); } catch { } }
/// <summary> /// Saves a record to the sol_QuantityButtons table. /// </summary> public virtual void Insert(Sol_QuantityButton sol_QuantityButton) { ValidationUtility.ValidateArgument("sol_QuantityButton", sol_QuantityButton); SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@WorkStationID", sol_QuantityButton.WorkStationID), new SqlParameter("@ControlType", sol_QuantityButton.ControlType), new SqlParameter("@Description", sol_QuantityButton.Description), new SqlParameter("@DefaultQuantity", sol_QuantityButton.DefaultQuantity), new SqlParameter("@CategoryID", sol_QuantityButton.CategoryID), new SqlParameter("@LocationX", sol_QuantityButton.LocationX), new SqlParameter("@LocationY", sol_QuantityButton.LocationY), new SqlParameter("@Width", sol_QuantityButton.Width), new SqlParameter("@Height", sol_QuantityButton.Height), new SqlParameter("@Font", sol_QuantityButton.Font), new SqlParameter("@FontStyle", sol_QuantityButton.FontStyle), new SqlParameter("@ForeColor", sol_QuantityButton.ForeColor), new SqlParameter("@BackColor", sol_QuantityButton.BackColor) }; sol_QuantityButton.QuantityButtonID = (int)SqlClientUtility.ExecuteScalar(connectionStringName, CommandType.StoredProcedure, "sol_QuantityButtons_Insert", parameters); }
public void Insert(UsuarioEntidad usuario) { ValidationUtility.ValidateArgument("usuario", usuario); SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@IdTipoUsuario", usuario.MiUsuario.IdTipoUsuario), new SqlParameter("@Email", usuario.Email), new SqlParameter("@Password", usuario.Password), new SqlParameter("@Nombre", usuario.Nombre), new SqlParameter("@Apellido", usuario.Apellido), new SqlParameter("@IdSexo", usuario.MiSexo.IdSexo), new SqlParameter("@NumeroDocumento", usuario.NumeroDocumento), new SqlParameter("@IdTipoTelefono", usuario.MiTelefono.IdTipoTelefono), new SqlParameter("@NumeroTelefono", usuario.NumeroTelefono), new SqlParameter("@DVH", usuario.DVH), }; var Resultado = (decimal)SqlClientUtility.ExecuteScalar(SqlClientUtility.connectionStringName, CommandType.StoredProcedure, "UsuarioInsert", parameters); int IdUsuarioRes = Decimal.ToInt32(Resultado); usuario.IdUsuario = IdUsuarioRes; }
public BusinessObject <List <EntityBase> > GetByName(string name) { ValidationUtility.ThrowIfNullOrEmpty(name, "name"); // Example: http://api.themoviedb.org/3/search/movie?api_key=c78b66672025d9b8a5fcb54a07c6ad84&query=transformers var entities = new BusinessObject <List <EntityBase> >(); var result = this.GetData("http://api.themoviedb.org/3/search/movie?api_key={0}&query={1}", name); if (result.Errors.IsNullOrEmpty()) { if (result.Data != null) { entities.Data = new List <EntityBase>(); ((IEnumerable <dynamic>)result.Data.results).ForEach(m => entities.Data.Add(this.MapToMovie(m))); } } else { entities.Errors.AddRange(result.Errors); } return(entities); }
/// <summary> /// Saves a record to the sol_Payments table. /// </summary> public virtual void Insert(Sol_Payment sol_Payment) { ValidationUtility.ValidateArgument("sol_Payment", sol_Payment); SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@PaymentAmount", sol_Payment.PaymentAmount), new SqlParameter("@date", sol_Payment.Date), new SqlParameter("@UserID", sol_Payment.UserID), new SqlParameter("@UserName", sol_Payment.UserName), new SqlParameter("@CustomerID", sol_Payment.CustomerID), new SqlParameter("@ChequeNumber", sol_Payment.ChequeNumber), new SqlParameter("@Name", sol_Payment.Name), new SqlParameter("@Address1", sol_Payment.Address1), new SqlParameter("@Address2", sol_Payment.Address2), new SqlParameter("@City", sol_Payment.City), new SqlParameter("@Province", sol_Payment.Province), new SqlParameter("@Country", sol_Payment.Country), new SqlParameter("@PostalCode", sol_Payment.PostalCode) }; sol_Payment.PaymentID = (int)SqlClientUtility.ExecuteScalar(connectionStringName, CommandType.StoredProcedure, "sol_Payments_Insert", parameters); }
/// <summary> /// Updates a record in the Sol_Employees table. /// </summary> public virtual void Update(Sol_Employee sol_Employee) { ValidationUtility.ValidateArgument("sol_Employee", sol_Employee); SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@UserId", sol_Employee.UserId), new SqlParameter("@FirstName", sol_Employee.FirstName), new SqlParameter("@LastName", sol_Employee.LastName), new SqlParameter("@MiddleName", sol_Employee.MiddleName), new SqlParameter("@BirthDate", sol_Employee.BirthDate), new SqlParameter("@HireDate", sol_Employee.HireDate), new SqlParameter("@EmployeeNotes", sol_Employee.EmployeeNotes), new SqlParameter("@SIN", sol_Employee.SIN), new SqlParameter("@Gender", sol_Employee.Gender), new SqlParameter("@EmployeeNumber", sol_Employee.EmployeeNumber), new SqlParameter("@PayrollNumber", sol_Employee.PayrollNumber), new SqlParameter("@CompensationAmount", sol_Employee.CompensationAmount), new SqlParameter("@CompensationType", sol_Employee.CompensationType) }; SqlClientUtility.ExecuteNonQuery(connectionStringName, CommandType.StoredProcedure, "Sol_Employees_Update", parameters); }
private void btnSave_Click(object sender, EventArgs e) { if (ValidationUtility.FieldNotAllowNull(this) == false) { return; } if (m_Product == null) { return; } CoverObjectUtility.GetAutoBindingData(this, m_Product); try { SaveProduct(); //gridUtility.UpdateRow<Product>(m_Product); lblNotify1.SetText(UI.success, LabelNotify.EnumStatus.Success); } catch { lblNotify1.SetText(UI.failed, LabelNotify.EnumStatus.Failed); } }
/// <summary> /// Saves a record to the Rule table. /// </summary> public virtual void Insert(Rule rule) { ValidationUtility.ValidateArgument("rule", rule); SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@Code", rule.Code), new SqlParameter("@Name", rule.Name), new SqlParameter("@IsActive", rule.IsActive), new SqlParameter("@RadiusK", rule.RadiusK), new SqlParameter("@WarnK", rule.WarnK), new SqlParameter("@Direction", rule.Direction), new SqlParameter("@Message", rule.Message), new SqlParameter("@Comments", rule.Comments), new SqlParameter("@InternalComment", rule.InternalComment), new SqlParameter("@CreatedBy", rule.CreatedBy), new SqlParameter("@CreatedOn", rule.CreatedOn), new SqlParameter("@AuditActionBy", rule.AuditActionBy), new SqlParameter("@AuditActionOn", rule.AuditActionOn) }; rule.ID = Convert.ToInt32(SqlClientUtility.ExecuteScalar(connectionStringName, CommandType.StoredProcedure, "RuleInsert", parameters)); }
public AspNetRequest(HttpRequestBase request) { _request = request; Cookies = new NameValueCollection(); foreach (string key in request.Cookies) { Cookies.Add(key, request.Cookies[key].Value); } // Since the ValidationUtility has a dependency on HttpContext (not HttpContextBase) we // need to check if we're out of HttpContext to preserve testability. if (HttpContext.Current == null) { _form = _request.Form; _queryString = _request.QueryString; } else { Func <NameValueCollection> formGetter, queryGetter; ValidationUtility.GetUnvalidatedCollections(HttpContext.Current, out formGetter, out queryGetter); _form = formGetter(); _queryString = queryGetter(); } }
protected void DetailsViewOfferItems_ItemInserted(object sender, DetailsViewInsertedEventArgs e) { if (e.Exception != null) { e.ExceptionHandled = true; e.KeepInInsertMode = true; ValidationUtility.ShowValidationErrors(this, e.Exception); } else { int offerID = Convert.ToInt32(e.Values["OfferID"]); decimal offerItemCost = Convert.ToDecimal(e.Values["Cost"]); Offer o = Offer.Get(offerID); o.Cost += offerItemCost; Offer.Table.Context.SubmitChanges(); odsOfferPreview.SelectParameters.Clear(); odsOfferPreview.SelectParameters.Add("id", offerID.ToString()); dvOfferPreview.DataBind(); odsGridViewOfferItems.SelectParameters.Clear(); odsGridViewOfferItems.SelectParameters.Add("offerID", offerID.ToString()); GridViewOfferItems.DataBind(); mvOfferItems.SetActiveView(viewOfferItemsGrid); } }
internal static void ValidateRequest(ControllerContext controllerContext) { if (controllerContext.IsChildAction) { return; } // DevDiv 214040: Enable Request Validation by default for all controller requests // // Earlier versions of this method dereferenced Request.RawUrl to force validation of // that field. This was necessary for Routing before ASP.NET v4, which read the incoming // path from RawUrl. Request validation has been moved earlier in the pipeline by default and // routing no longer consumes this property, so we don't have to either. // Tolerate null HttpContext for testing HttpContext currentContext = HttpContext.Current; if (currentContext != null) { ValidationUtility.EnableDynamicValidation(currentContext); } controllerContext.HttpContext.Request.ValidateInput(); }
/// <summary> /// Updates a record in the sol_Products table. /// </summary> public virtual void Update(Sol_Product sol_Product) { ValidationUtility.ValidateArgument("sol_Product", sol_Product); SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@ProductID", sol_Product.ProductID), new SqlParameter("@ProName", sol_Product.ProName), new SqlParameter("@ProDescription", sol_Product.ProDescription), new SqlParameter("@ProShortDescription", sol_Product.ProShortDescription), new SqlParameter("@ProImage", sol_Product.ProImage), new SqlParameter("@AgencyID", sol_Product.AgencyID), new SqlParameter("@MenuOrder", sol_Product.MenuOrder), new SqlParameter("@IsActive", sol_Product.IsActive), new SqlParameter("@Price", sol_Product.Price), new SqlParameter("@CategoryID", sol_Product.CategoryID), new SqlParameter("@RefundAmount", sol_Product.RefundAmount), new SqlParameter("@HandlingCommissionAmount", sol_Product.HandlingCommissionAmount), new SqlParameter("@CommissionUnit", sol_Product.CommissionUnit), new SqlParameter("@VafAmount", sol_Product.VafAmount), new SqlParameter("@FeeUnit", sol_Product.FeeUnit), new SqlParameter("@ContainerID", sol_Product.ContainerID), new SqlParameter("@StandardDozenID", sol_Product.StandardDozenID), new SqlParameter("@UPC", sol_Product.UPC), new SqlParameter("@ProductCode", sol_Product.ProductCode), new SqlParameter("@TypeId", sol_Product.TypeId), new SqlParameter("@Tax1Exempt", sol_Product.Tax1Exempt), new SqlParameter("@Tax2Exempt", sol_Product.Tax2Exempt), new SqlParameter("@MasterProductID", sol_Product.MasterProductID), new SqlParameter("@Weight", sol_Product.Weight), new SqlParameter("@Volume", sol_Product.Volume), new SqlParameter("@TargetQuantity", sol_Product.TargetQuantity) }; SqlClientUtility.ExecuteNonQuery(connectionStringName, CommandType.StoredProcedure, "sol_Products_Update", parameters); }
public static void Initialize(this AdminOverviewModel model) { var settings = Database.Instance.GetSettings(); model.ActiveEventsCount = Database.Instance.GetActiveEventsCount(); model.NewestBooking = Database.Instance.GetNewestActiveBooking(); model.PendingBookingsCount = Database.Instance.GetPendingBookingsCount(); model.RulesCount = Database.Instance.GetRuleCount(); model.TotalBookingCount = Database.Instance.GetTotalBookingCount(); model.UpcomingBookings = Database.Instance.GetUpcomingBookingsFor(DateTime.Today); if (Database.Instance.GetEmailRecipientsCount() == 0) { model.Warnings.Add(AdminOverviewModel.Warning.NO_EMAIL_RECIPIENTS_CONFIGURED); } if (model.ActiveEventsCount == 0) { model.Warnings.Add(AdminOverviewModel.Warning.NO_EVENTS_CONFIGURED); } if (Database.Instance.GetTimesCount() == 0) { model.Warnings.Add(AdminOverviewModel.Warning.NO_TIMES_CONFIGURED); } if (!ValidationUtility.AreNotNullOrWhitespace(settings.EmailContent, settings.EmailSubject)) { model.Warnings.Add(AdminOverviewModel.Warning.NO_EMAIL_CONTENT_CONFIGURED); } if (!ValidationUtility.AreNotNullOrWhitespace(settings.ConfirmationPageContent)) { model.Warnings.Add(AdminOverviewModel.Warning.NO_CONFIRMATION_PAGE_CONTENT_CONFIGURED); } }
public async Task <IEnumerable <CheckBatch> > GetCheckBatchesAsync(int skip, int take, bool asc, CancellationToken token) { ValidationUtility.ValidatePagingParameters(skip, take); IQueryable <Entities.CheckBatch> checkBatches = _context.CheckBatches; if (asc) { checkBatches = checkBatches.OrderBy(x => x.CheckBatchId); } else { checkBatches = checkBatches.OrderByDescending(x => x.CheckBatchId); } var entities = await checkBatches .Skip(skip) .Take(take) .ToListAsync(token); return(entities .Select(_entityMapper.ToBusiness) .ToList()); }
public List <PropertyDescriptionCodeDTO> Search(PropertyDescriptionCodeDTO propertyDescriptionCodeDTO) { List <PropertyDescriptionCodeDTO> list = new List <PropertyDescriptionCodeDTO>(); string sql = "Select * from [dbo].[r_Property_Desc_Code] Where 1=1 "; sql = string.Format(sql, propertyDescriptionCodeDTO.PropertyDescCode); // if property description code is not null then filter with it too. if (!ValidationUtility.IsNull(propertyDescriptionCodeDTO.PropertyDescCodeDescription)) { sql = String.Format(sql + " AND Property_Description_Code_Description = '{0}'", propertyDescriptionCodeDTO.PropertyDescCodeDescription); } if (!ValidationUtility.IsNull(propertyDescriptionCodeDTO.PropertyDescCode)) { sql = String.Format(sql + " AND Property_Description_Code = '{0}'", propertyDescriptionCodeDTO.PropertyDescCode); } if (propertyDescriptionCodeDTO.LoanProgram > 0) { sql = String.Format(sql + " AND Loan_Program = '{0}'", propertyDescriptionCodeDTO.LoanProgram); } using (SqlConnection con = OpenConnection()) { using (SqlDataReader dataReader = ExecuteQuery(sql, con)) { while (dataReader.Read()) { list.Add(MakeDTO(null, dataReader)); } } } return(list); }
public async Task <IEnumerable <HeartGroup> > GetHeartGroupsAsync(int skip, int take, bool asc, CancellationToken token) { ValidationUtility.ValidatePagingParameters(skip, take); IQueryable <Entities.HeartGroup> heartGroups = _context.HeartGroups; if (asc) { heartGroups = heartGroups.OrderBy(x => x.HeartGroupId); } else { heartGroups = heartGroups.OrderByDescending(x => x.HeartGroupId); } var entities = await heartGroups .Skip(skip) .Take(take) .ToListAsync(token); return(entities .Select(_entityMapper.ToBusiness) .ToList()); }
public static IEntityService GetService(EntityBase entity) { ValidationUtility.ThrowIfNullOrEmpty(entity, "entity"); IEntityService service = null; if (entity is Show) { service = new ShowService(); } else if (entity is Episode) { service = new EpisodeService(); } else if (entity is Season) { service = new SeasonService(); } else if (entity is Movie) { service = new MovieService(); } return(service); }
private void btnCreateAccount_Click(object sender, EventArgs e) { if (ValidationUtility.FieldNotAllowNull(groupBox1) == false) { lblNotify1.SetText(UI.hasnoinfomation, LabelNotify.EnumStatus.Failed); return; } if (m_User == null) { m_User = new Users(); } CoverObjectUtility.GetAutoBindingData(this.tableLayoutPanel2, m_User); if (string.IsNullOrWhiteSpace(m_User.Password)) { m_User.Password = UtilityFunction.GetSHA256Hash(m_User.UserName); } m_User.UserId = 0; if (m_User == null) { return; } try { SaveAccount(m_User); lblNotify1.SetText(UI.success, LabelNotify.EnumStatus.Success); gridUtility1.AddNewRow <Deputy>(m_Deputy); } catch { lblNotify1.SetText(UI.failed, LabelNotify.EnumStatus.Failed); } }
/// <summary> /// Updates a record in the CT_DON_DAT_HANG table. /// </summary> public void Update(CTDONDATHANG_DTO CtDonDatHang) { ValidationUtility.ValidateArgument("CtDonDatHang", CtDonDatHang); new CTDONDATHANG_DAO().Update(CtDonDatHang); }
/// <summary> /// Updates a record in the PHIEU_XUAT_XE table. /// </summary> public void Update(PHIEUXUATXE_DTO PhieuXuatXe) { ValidationUtility.ValidateArgument("PhieuXuatXe", PhieuXuatXe); new PHIEUXUATXE_DAO().Update(PhieuXuatXe); }
/// <summary> /// Initializes a new instance of the Messaging class. /// </summary> public Messaging(string connectionStringName) { ValidationUtility.ValidateArgument("connectionStringName", connectionStringName); this.connectionStringName = connectionStringName; }