Esempio n. 1
0
        public Response UpdateWeighmentDetails(WeighmentDetails obj)
        {
            var currentUser = System.Web.HttpContext.Current.Session["employeeName"].ToString();
            var IsExist     = entities.weighments.Where(x => x.serialNo == obj.serialNo).ToList();

            if (IsExist.Count != 0)
            {
                var weighObj = entities.weighments.Where(x => x.serialNo == obj.serialNo).FirstOrDefault();
                weighObj.date            = obj.date;
                weighObj.weighmentType   = obj.weighmentType;
                weighObj.salesMode       = obj.salesMode;
                weighObj.unit            = obj.unit;
                weighObj.vehicleNo       = obj.vehicleNo;
                weighObj.driverName      = obj.driverName;
                weighObj.customerName    = obj.customerName;
                weighObj.placeOfDelivery = obj.placeOfDelivery;
                weighObj.loadType        = obj.loadType;
                weighObj.material        = obj.material;
                weighObj.grossWeight     = obj.grossWeight;
                weighObj.tareWeight      = obj.tareWeight;
                weighObj.netWeight       = obj.netWeight;
                weighObj.rate            = obj.rate;
                weighObj.tax             = obj.tax;
                weighObj.rent            = obj.rent;
                weighObj.amount          = obj.amount;
                weighObj.netAmount       = obj.netAmount;
                //weighObj.createdBy = currentUser;
                weighObj.updatedBy = currentUser;
                weighObj.updatedOn = DateTime.Now;
                entities.SaveChanges();
                long id = weighObj.serialNo;
                return(new Response {
                    IsSuccess = true, Message = "Weighment details Updated", ReturnId = id
                });
            }
            else
            {
                return new Response {
                           IsSuccess = false, Message = "Error"
                }
            };
        }
Esempio n. 2
0
        public Response SaveWeighmentDetails(WeighmentDetails obj)
        {
            List <WeighmentDetails> weighList = new List <WeighmentDetails>();
            var       currentUser             = System.Web.HttpContext.Current.Session["employeeName"].ToString();
            weighment weighObj = new weighment();

            weighObj.date            = obj.date;
            weighObj.weighmentType   = obj.weighmentType;
            weighObj.salesMode       = obj.salesMode;
            weighObj.unit            = obj.unit;
            weighObj.vehicleNo       = obj.vehicleNo;
            weighObj.driverName      = obj.driverName;
            weighObj.customerName    = obj.customerName;
            weighObj.placeOfDelivery = obj.placeOfDelivery;
            weighObj.loadType        = obj.loadType;
            weighObj.material        = obj.material;
            weighObj.grossWeight     = obj.grossWeight;
            weighObj.tareWeight      = obj.tareWeight;
            weighObj.netWeight       = obj.netWeight;
            weighObj.rate            = obj.rate;
            weighObj.tax             = obj.tax;
            weighObj.rent            = obj.rent;
            weighObj.amount          = obj.amount;
            weighObj.netAmount       = obj.netAmount;
            weighObj.createdBy       = currentUser;
            weighObj.createdOn       = DateTime.Now;
            weighObj.updatedBy       = currentUser;
            weighObj.updatedOn       = DateTime.Now;
            entities.weighments.Add(weighObj);

            entities.SaveChanges();
            long id = weighObj.serialNo;

            return(new Response {
                IsSuccess = true, Message = "Empty weighment details added", ReturnId = id
            });
        }
Esempio n. 3
0
        public ActionResult SaveWeighments(string serialNo, string date, string weighmentType, string salesMode, string unit, string vehicleNo, string driverName, string customerName, string placeOfDelivery, string loadType, string material, string grossWeight, string tareWeight, string netWeight, string rate, string tax, string rent, string amount, string netAmount)
        {
            if (serialNo == "" || serialNo == null)
            {
                serialNo = "0";
            }
            if (grossWeight == "" || grossWeight == null)
            {
                grossWeight = "0";
            }
            if (tareWeight == "" || tareWeight == null)
            {
                tareWeight = "0";
            }
            if (netWeight == "" || netWeight == null)
            {
                netWeight = "0";
            }
            if (tax == "" || tax == null)
            {
                tax = "0";
            }
            if (rate == "" || rate == null)
            {
                rate = "0";
            }
            if (rent == "" || rent == null)
            {
                rent = "0";
            }
            if (amount == "" || amount == null)
            {
                amount = "0";
            }
            if (netAmount == "" || netAmount == null)
            {
                netAmount = "0";
            }

            Response         res        = new Response();
            List <object>    resultList = new List <object>();
            var              serialFlag = Int32.Parse(serialNo);
            WeighmentDetails weight     = new WeighmentDetails();

            weight.serialNo        = serialFlag;
            weight.date            = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
            weight.weighmentType   = weighmentType;
            weight.salesMode       = salesMode;
            weight.unit            = unit;
            weight.vehicleNo       = vehicleNo;
            weight.driverName      = driverName;
            weight.customerName    = customerName;
            weight.placeOfDelivery = placeOfDelivery;
            weight.loadType        = loadType;
            weight.material        = material;
            weight.grossWeight     = float.Parse(grossWeight);
            weight.tareWeight      = float.Parse(tareWeight);
            weight.netWeight       = float.Parse(netWeight);
            weight.rate            = float.Parse(rate);
            weight.tax             = float.Parse(tax);
            weight.rent            = float.Parse(rent);
            weight.amount          = float.Parse(amount);
            weight.netAmount       = float.Parse(netAmount);
            if (serialFlag == 0)
            {
                res = weighDAL.SaveWeighmentDetails(weight);
            }
            else
            {
                res = weighDAL.UpdateWeighmentDetails(weight);
            }
            resultList.Add(res);
            return(Json(resultList, JsonRequestBehavior.AllowGet));
        }