public ActionResult <IDataPacker> DeleteSalesOrderByKey(IDataUnpacker unpacker) { var packer = new DataPacker(); var modelName = unpacker.GetValue <string>("arm1"); var saleOrderId = unpacker.GetValue <int>("arm2"); var status = "Success"; try { switch (modelName) { case "SaleOrder": status = _saleService.DeleteSalesOrder(saleOrderId); break; case "OrderDetail": var saleDetailId = unpacker.GetValue <int>("arm3"); status = _saleService.Delete <SalesOrderDetail>(true, m => m.SalesOrderDetailID == saleDetailId, saleOrderId); break; } } catch (Exception e) { return(StatusCode(500, e.Message)); } packer.AddValue("Status", status); return(packer); }
public ActionResult <IDataPacker> DeleteSalesOrderByKey(IDataUnpacker unpacker) { var packer = new DataPacker(); var modelName = unpacker.GetValue <string>("arm1"); var saleOrderId = unpacker.GetValue <int>("arm2"); var status = "Success"; try { switch (modelName) { case "SaleOrder": status = _saleService.DeleteSalesOrder(saleOrderId); break; case "OrderDetail": var saleDetailId = unpacker.GetValue <int>("arm3"); status = _saleService.Delete("d_order_detail_list", true, "SalesOrderDetailID = " + saleDetailId.ToString(), saleOrderId); break; } } catch (Exception e) { return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } packer.AddValue("Status", status); return(packer); }
public ActionResult <IDataPacker> DeleteByKey(IDataUnpacker unpacker) { var packer = new DataPacker(); var dwname = unpacker.GetValue <string>("arm1"); var personId = unpacker.GetValue <int>("arm2"); var status = "Success"; try { switch (dwname) { case "Person": status = _personService.DeletePerson(personId); break; case "PersonAddress": var addressId = unpacker.GetValue <int>("arm3"); var addressTypeId = unpacker.GetValue <int>("arm4"); status = _personService.Delete("d_businessentityaddress", true, "Addressid = " + addressId.ToString() + " And " + "Addresstypeid = " + addressTypeId.ToString(), personId); break; case "PersonPhone": var personNumber = unpacker.GetValue <string>("arm3"); var phonenumbertypeid = unpacker.GetValue <int>("arm4"); status = _personService.Delete("d_personphone", true, "Phonenumber = '" + personNumber.ToString() + "' And " + "Phonenumbertypeid = " + phonenumbertypeid.ToString(), personId); break; case "Customer": var customerId = unpacker.GetValue <int>("arm3"); status = _personService.Delete("d_customer", true, customerId); break; } } catch (Exception e) { return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } packer.AddValue("Status", status); return(packer); }
public ActionResult <IDataPacker> SaveProductPhoto(IDataUnpacker unpacker) { var packer = new DataPacker(); var productId = unpacker.GetValue <int>("arm1"); var photoName = unpacker.GetValue <string>("arm2"); var productPhoto = unpacker.GetValue <string>("arm3"); byte[] bProductPhoto = Convert.FromBase64String(productPhoto); try { _productService.SaveProductPhoto(productId, photoName, bProductPhoto); packer.AddValue("Status", "Success"); } catch (Exception e) { return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } return(packer); }
public ActionResult <IDataPacker> DeleteByKey(IDataUnpacker unpacker) { var packer = new DataPacker(); var dwname = unpacker.GetValue <string>("arm1"); var personId = unpacker.GetValue <int>("arm2"); var status = "Success"; try { switch (dwname) { case "Person": status = _personService.DeletePerson(personId); break; case "PersonAddress": var addressId = unpacker.GetValue <int>("arm3"); var addressTypeId = unpacker.GetValue <int>("arm4"); status = _personService.Delete <BusinessEntityAddress>(true, m => m.Addressid == addressId && m.Addresstypeid == addressTypeId, personId); break; case "PersonPhone": var personNumber = unpacker.GetValue <string>("arm3"); var phonenumbertypeid = unpacker.GetValue <int>("arm4"); status = _personService.Delete <PersonPhone>(true, m => m.Phonenumber == personNumber && m.Phonenumbertypeid == phonenumbertypeid, personId); break; case "Customer": var customerId = unpacker.GetValue <int>("arm3"); status = _personService.Delete <Customer>(true, customerId); break; } } catch (Exception e) { return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } packer.AddValue("Status", status); return(packer); }
public ActionResult <IDataPacker> DeleteSubcategoryByKey(IDataUnpacker unpacker) { var packer = new DataPacker(); var subCateId = unpacker.GetValue <int>("arm1"); try { var status = _productService.Delete <SubCategory>(subCateId); packer.AddValue("Status", status); } catch (Exception e) { return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } return(packer); }
public ActionResult <IDataPacker> DeleteAddressByKey(IDataUnpacker unpacker) { var packer = new DataPacker(); var addressId = unpacker.GetValue <int>("arm1"); try { var status = _addressService.Delete <Address>(addressId); packer.AddValue("Status", status); } catch (Exception e) { return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } return(packer); }
public ActionResult <IDataPacker> SaveChanges(IDataUnpacker unpacker) { var packer = new DataPacker(); var modelname = unpacker.GetValue <string>("arm1"); var status = "Success"; try { switch (modelname) { case "SubCategory": var subcate = unpacker.GetModelStore <SubCategoryList>("dw1", ChangeTrackingStrategy.PropertyState); status = _productService.Update(true, subcate); var modelId = subcate.FirstOrDefault().Productcategoryid; packer.AddModelStore("SubCategory", subcate); break; case "Product": var prod = unpacker.GetModelStore <Product>("dw1", ChangeTrackingStrategy.PropertyState); status = _productService.Update(true, prod); var productId = prod.FirstOrDefault().Productid; packer.AddModelStore("Product", _productService.Retrieve <Product>(productId)); packer.AddModelStore("Product.HistoryPrice", _productService.Retrieve <HistoryPrice>(productId)); break; } } catch (Exception e) { return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } packer.AddValue("Status", status); return(packer); }
public ActionResult <IDataPacker> DeleteProductByKey(IDataUnpacker unpacker) { var packer = new DataPacker(); var productId = unpacker.GetValue <int>("arm1"); try { var status = _productService.DeleteProduct(productId); packer.AddValue("Status", status); } catch (Exception e) { return(StatusCode(500, e.Message)); } return(packer); }
public ActionResult<IDataPacker> Delete(IDataUnpacker unpacker) { var packer = new DataPacker(); var status = "Success"; var modelname = unpacker.GetValue<string>("arm1"); try { switch (modelname) { case "SubCategory": var subCateId = unpacker.GetDataStore("dw1", "d_subcategory") .FirstOrDefault<D_Subcategory>() .Productsubcategoryid; status = _productService.Delete("d_subcategory", subCateId); break; case "Product": var productId = unpacker.GetDataStore("deletedw1", "d_product") .FirstOrDefault<D_Product>() .Productid; status = _productService.DeleteProduct(productId); break; } } catch (Exception e) { return StatusCode(StatusCodes.Status500InternalServerError, e.Message); } packer.AddValue("Status", status); return packer; }
public ActionResult <IDataPacker> SaveChanges(IDataUnpacker unpacker) { string status = "Success"; var packer = new DataPacker(); var modelname = unpacker.GetValue <string>("arm1"); try { switch (modelname) { case "SaleOrderHeader": var orderHeader = unpacker.GetModelStore <SalesOrderHeader> ("dw1", ChangeTrackingStrategy.PropertyState); status = _saleService.Update(true, orderHeader); packer.AddModelStore("SalesOrderHeader", orderHeader); break; case "SaleOrderDetail": var orderDetail = unpacker.GetModelStore <SalesOrderDetail> ("dw1", ChangeTrackingStrategy.PropertyState); status = _saleService.Update(true, orderDetail); packer.AddValue("SaleOrderDetail.SalesOrderDetail", orderDetail.Count); break; } } catch (Exception e) { return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } packer.AddValue("Status", status); return(packer); }
public ActionResult <IDataPacker> SaveChanges(IDataUnpacker unpacker) { var status = "Success"; var packer = new DataPacker(); var modelname = unpacker.GetValue <string>("arm1"); try { switch (modelname) { case "SaleOrderHeader": var orderHeader = unpacker.GetDataStore("dw1", "d_order_header_free"); status = _saleService.Update(true, orderHeader); packer.AddDataStore("SalesOrderHeader", orderHeader); break; case "SaleOrderDetail": var orderDetail = unpacker.GetDataStore("dw1", "d_order_detail_list"); status = _saleService.Update(true, orderDetail); packer.AddValue("SaleOrderDetail.SalesOrderDetail", orderDetail.RowCount); break; } } catch (Exception e) { return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } packer.AddValue("Status", status); return(packer); }
public ActionResult <IDataPacker> Delete(IDataUnpacker unpacker) { var packer = new DataPacker(); var status = "Success"; var modelname = unpacker.GetValue <string>("arm1"); try { switch (modelname) { case "SubCategory": var subCateId = unpacker.GetModelStore <SubCategory>("dw1", ChangeTrackingStrategy.PropertyState) .FirstOrDefault().Productsubcategoryid; status = _productService.Delete <SubCategory>(subCateId); break; case "Product": var productId = unpacker.GetModelStore <ProductList>("deletedw1", ChangeTrackingStrategy.PropertyState) .FirstOrDefault().Productid; status = _productService.DeleteProduct(productId); break; } } catch (Exception e) { return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } packer.AddValue("Status", status); return(packer); }