public static SalesCenter GetSalesCenterBySalesCenterId(int SalesCenterId) { SalesCenter salesCenter = new SalesCenter(); SqlSalesCenterProvider sqlSalesCenterProvider = new SqlSalesCenterProvider(); salesCenter = sqlSalesCenterProvider.GetSalesCenterBySalesCenterId(SalesCenterId); return salesCenter; }
private void showSalesCenterData() { SalesCenter salesCenter = new SalesCenter(); salesCenter = SalesCenterManager.GetSalesCenterBySalesCenterId(Int32.Parse(Request.QueryString["ID"])); txtSalesCenterName.Text = salesCenter.SalesCenterName.ToString(); }
public static SalesCenter GetSalesCenterBySalesCenterId(int SalesCenterId) { SalesCenter salesCenter = new SalesCenter(); SqlSalesCenterProvider sqlSalesCenterProvider = new SqlSalesCenterProvider(); salesCenter = sqlSalesCenterProvider.GetSalesCenterBySalesCenterId(SalesCenterId); return(salesCenter); }
protected void btnAdd_Click(object sender, EventArgs e) { SalesCenter salesCenter = new SalesCenter(); // salesCenter.SalesCenterId= int.Parse(txtSalesCenterId.Text); salesCenter.SalesCenterName = txtSalesCenterName.Text; int resutl = SalesCenterManager.InsertSalesCenter(salesCenter); Response.Redirect("AdminDisplaySalesCenter.aspx"); }
protected void btnUpdate_Click(object sender, EventArgs e) { SalesCenter salesCenter = new SalesCenter(); salesCenter.SalesCenterId = int.Parse(Request.QueryString["ID"].ToString()); salesCenter.SalesCenterName = txtSalesCenterName.Text; bool resutl = SalesCenterManager.UpdateSalesCenter(salesCenter); Response.Redirect("AdminDisplaySalesCenter.aspx"); }
public VentasCentro <CustomerRate> FillSalesCenter(VentasCentro <CustomerRate> ventasCentro, int mode = -1) { foreach (CustomerRate customer in ventasCentro.Items) { List <SalesCenter> oSales = new List <SalesCenter>(); foreach (LabelAndValue <DateTime> date in ventasCentro.Dates) { if (mode == 1) { SalesCenter sale = customer.SalesCenters.SingleOrDefault(o => o.PostingDate.Value.Day == date.Value.Day && o.PostingDate >= customer.StartingDate && (o.PostingDate <= customer.EndingDate || customer.EndingDate == null)); if (sale == null) { oSales.Add(new SalesCenter()); } else { oSales.Add(sale); } } else if (mode == 7) { SalesCenter weekSale = new SalesCenter() { Quantity = 0 }; foreach (SalesCenter sales in customer.SalesCenters) { if (sales.PostingDate.Value >= date.Value && sales.PostingDate.Value <= Convert.ToDateTime(date.Data)) { weekSale.Quantity += sales.Quantity; } } oSales.Add(weekSale); } else if (mode == 12) { SalesCenter monthSale = new SalesCenter() { Quantity = 0 }; foreach (SalesCenter sales in customer.SalesCenters) { if (sales.PostingDate.Value >= date.Value && sales.PostingDate.Value <= new DateTime(date.Value.Year, date.Value.Month, DateTime.DaysInMonth(date.Value.Year, date.Value.Month))) { monthSale.Quantity += sales.Quantity; } } oSales.Add(monthSale); } } customer.SalesCenters = oSales; } return(ventasCentro); }
public SalesCenter_View(SalesCenter s) { EntryNo = s.EntryNo; CenterCode = s.CenterCode ?? ""; CustomerNo = s.CustomerNo ?? ""; ItemNo = s.ItemNo ?? ""; PostingDate = s.PostingDate.Value.ToString("dd MMMM dddd") ?? DateTimeOffset.MinValue.ToString(); Quantity = s.Quantity ?? 0; PostingStatus = s.PostingStatus ?? ""; ReadingDate = s.ReadingDate ?? DateTimeOffset.MinValue; Amount = s.Amount ?? 0; }
public bool UpdateSalesCenter(SalesCenter salesCenter) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("UpdateSalesCenter", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@SalesCenterId", SqlDbType.Int).Value = salesCenter.SalesCenterId; cmd.Parameters.Add("@SalesCenterName", SqlDbType.NVarChar).Value = salesCenter.SalesCenterName; connection.Open(); int result = cmd.ExecuteNonQuery(); return(result == 1); } }
public int InsertSalesCenter(SalesCenter salesCenter) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("InsertSalesCenter", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@SalesCenterId", SqlDbType.Int).Direction = ParameterDirection.Output; cmd.Parameters.Add("@SalesCenterName", SqlDbType.NVarChar).Value = salesCenter.SalesCenterName; connection.Open(); int result = cmd.ExecuteNonQuery(); return((int)cmd.Parameters["@SalesCenterId"].Value); } }
public ResultAndError <SalesCenter> Add(SalesCenter c) { ResultAndError <SalesCenter> result = new ResultAndError <SalesCenter>(); try { db.SalesCenters.Add(c); db.SaveChanges(); return(result.AddResult(c)); } catch (Exception e) { return(result.AddError(e, HttpStatusCode.InternalServerError)); } }
public bool DeleteMulti(IEnumerable <string> SalesCenters) { List <SalesCenter> oSalesCenters = new List <SalesCenter>(); foreach (string SalesCenterNo in SalesCenters) { SalesCenter oSalesCenter = Get(SalesCenterNo); if (oSalesCenter != null) { oSalesCenters.Add(oSalesCenter); } } db.SalesCenters.RemoveRange(oSalesCenters); db.SaveChanges(); return(true); }
public SalesCenter GetSalesCenterFromReader(IDataReader reader) { try { SalesCenter salesCenter = new SalesCenter ( DataAccessObject.IsNULL <int>(reader["SalesCenterId"]), DataAccessObject.IsNULL <string>(reader["SalesCenterName"]) ); return(salesCenter); } catch (Exception ex) { return(null); } }
public bool UpdateMulti(IEnumerable <SalesCenter> oSalesCenters, bool insertIfNoExists = false) { foreach (SalesCenter SalesCenter in oSalesCenters) { SalesCenter old = Get(SalesCenter.ItemNo); if (old == null && insertIfNoExists) { Add(SalesCenter); } else { db.Entry(old).CurrentValues.SetValues(SalesCenter); } } db.SaveChanges(); return(true); }
public ResultAndError <bool> UpdateReadingDate(IEnumerable <int> centersNo, DateTimeOffset readingDate) { ResultAndError <bool> result = new ResultAndError <bool>(); try { foreach (int no in centersNo) { SalesCenter oSalesCenter = Get(no.ToString()); oSalesCenter.ReadingDate = readingDate; db.SaveChanges(); } return(result.AddResult(true)); } catch (Exception e) { return(result.AddError(e, HttpStatusCode.InternalServerError)); } }
public ResultAndError <SalesCenter> Update(SalesCenter cr, bool insertIfNoExists = false) { ResultAndError <SalesCenter> result = new ResultAndError <SalesCenter>(); try { SalesCenter old = Get(cr.ItemNo); if (old == null && insertIfNoExists) { return(Add(cr)); } db.Entry(old).CurrentValues.SetValues(cr); db.SaveChanges(); return(result.AddResult(cr)); } catch (Exception e) { return(result.AddError(e, HttpStatusCode.InternalServerError)); } }
public ResultAndError <bool> Delete(string id) { ResultAndError <bool> result = new ResultAndError <bool>(); try { SalesCenter SalesCenter = Get(id); if (SalesCenter == null) { return(result.AddError("No se encontro la tarifa con el id " + id)); } db.SalesCenters.Remove(SalesCenter); db.SaveChanges(); return(result.AddResult(true)); } catch (Exception e) { return(result.AddError(e, HttpStatusCode.InternalServerError)); } }
public SalesCenter GetSalesCenterFromReader(IDataReader reader) { try { SalesCenter salesCenter = new SalesCenter ( DataAccessObject.IsNULL<int>(reader["SalesCenterId"]), DataAccessObject.IsNULL<string>(reader["SalesCenterName"]) ); return salesCenter; } catch(Exception ex) { return null; } }
public bool UpdateSalesCenter(SalesCenter salesCenter) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("UpdateSalesCenter", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@SalesCenterId", SqlDbType.Int).Value = salesCenter.SalesCenterId; cmd.Parameters.Add("@SalesCenterName", SqlDbType.NVarChar).Value = salesCenter.SalesCenterName; connection.Open(); int result = cmd.ExecuteNonQuery(); return result == 1; } }
public static int InsertSalesCenter(SalesCenter salesCenter) { SqlSalesCenterProvider sqlSalesCenterProvider = new SqlSalesCenterProvider(); return(sqlSalesCenterProvider.InsertSalesCenter(salesCenter)); }
public IActionResult UpdSalesCenter([FromBody] SalesCenter SalesCenter, bool insertIfNoExists = false) { return(Ok(sBS.Update(SalesCenter, insertIfNoExists))); }
public static bool UpdateSalesCenter(SalesCenter salesCenter) { SqlSalesCenterProvider sqlSalesCenterProvider = new SqlSalesCenterProvider(); return sqlSalesCenterProvider.UpdateSalesCenter(salesCenter); }
public static int InsertSalesCenter(SalesCenter salesCenter) { SqlSalesCenterProvider sqlSalesCenterProvider = new SqlSalesCenterProvider(); return sqlSalesCenterProvider.InsertSalesCenter(salesCenter); }
public static bool UpdateSalesCenter(SalesCenter salesCenter) { SqlSalesCenterProvider sqlSalesCenterProvider = new SqlSalesCenterProvider(); return(sqlSalesCenterProvider.UpdateSalesCenter(salesCenter)); }
public int InsertSalesCenter(SalesCenter salesCenter) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("InsertSalesCenter", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@SalesCenterId", SqlDbType.Int).Direction = ParameterDirection.Output; cmd.Parameters.Add("@SalesCenterName", SqlDbType.NVarChar).Value = salesCenter.SalesCenterName; connection.Open(); int result = cmd.ExecuteNonQuery(); return (int)cmd.Parameters["@SalesCenterId"].Value; } }