Ejemplo n.º 1
0
        public ActionResult Create(DistributorSaleDTO obj, FormCollection frm, string tri)
        {
            try
            {
                if (string.IsNullOrEmpty(Convert.ToString(obj.RetailerId)))
                {
                    ModelState.AddModelError("Error", "Please Select Retailer");
                }
                else
                {
                    obj.DistributorSaleId = 0;
                    obj.CreatedBy         = Convert.ToInt32(Session["UserID"]);

                    DateTime     timeUtc = System.DateTime.UtcNow;
                    TimeZoneInfo cstZone = TimeZoneInfo.FindSystemTimeZoneById("India Standard Time");
                    DateTime     cstTime = TimeZoneInfo.ConvertTimeFromUtc(timeUtc, cstZone);
                    obj.CreatedDate = cstTime;


                    objdistributorsale.InsertDistributorSale(obj);
                    TempData["MessageRegistration"] = "Data Saved Successfully!";
                    //  ViewData["VSaleOrder"]= obj.SaleOrder;
                    TempData["AddPaperTrn"]       = "AddPapaerTrn";
                    Session["TransDate"]          = obj.TransDate.ToShortDateString();
                    ViewBag.VRetailerId           = obj.RetailerId;
                    Session["SaleOrder"]          = obj.SaleOrder;
                    Session["RetailerId"]         = obj.RetailerId;
                    Session["PrvBalanceRetailer"] = obj.PrvBalanceAmount;
                    return(RedirectToAction("AddProductT"));
                }
                obj.ListRetailer = BindListRetailer_DSale(tri);
                // obj.ListPaperbyCityId = BindListPaper(tri);
                //obj.ListCity = BindListCity();
                ViewData["SelectedrRetailer"] = obj.RetailerId;
                //ViewData["SelectedPaper"] = obj.PaperId;
                //ViewData["SelectedCity"] = obj.CityId;
                return(View(obj));
            }
            catch (Exception)
            {
                throw;
            }
        }
 public HttpResponseMessage CRMainOrder([FromBody] DistributorSaleDTO Distributorsale)
 {
     try
     {
         objDistributorSale.InsertDistributorSale(Distributorsale);
         var message = Request.CreateResponse <DistributorSaleDTO>(HttpStatusCode.Created, Distributorsale);
         message.Headers.Location = new Uri(Request.RequestUri + Distributorsale.DistributorSaleId.ToString());
         return(message);
         //string uri = Url.Link("DefaultApi", new { orderID = order.OrderId });
         //response.Headers.Location = new Uri(uri);
         //return response;
         //return Request.CreateResponse(HttpStatusCode.Created);
     }
     catch (Exception ex)
     {
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
         // return 0;
     }
 }