コード例 #1
0
        public ActionResult Save(InvDamage objInvDamage)
        {
            Operation objOperation = new Operation();
            userId = Convert.ToInt32(Session["userId"]);
            companyId = Convert.ToInt32(Session["companyId"]);
            if (ModelState.IsValid)
            {

                    objInvDamage.SecCompanyId = companyId;
                   objInvDamage.CreatedBy = userId;
                   objInvDamage.CreatedDate = DateTime.Now;
                   objInvDamage.ModifiedBy = userId;
                   objInvDamage.ModifiedDate = DateTime.Now;

                if (objInvDamage.Id == 0)
                {
                    objOperation = _DamageService.Save(objInvDamage);
                }
                else
                {
                    objOperation = _DamageService.Update(objInvDamage);
                }
            }

            return Json(objOperation, JsonRequestBehavior.DenyGet);
        }
コード例 #2
0
        public ActionResult Save(InvDamage invDamage)
        {
            int companyId = Convert.ToInt32(Session["companyId"]);
            int userId = Convert.ToInt32(Session["userId"]);

            Operation objOperation = new Operation { Success = false };
            if (ModelState.IsValid && invDamage != null)
            {
                if (invDamage.Id == 0)
                {
                    if ((bool)Session["Add"])
                    {
                        invDamage.SecCompanyId = companyId;
                        invDamage.CreatedBy = userId;
                        invDamage.CreatedDate = DateTime.Now;
                        //invDamage.InvDamageDetails = null;
                        objOperation = _IDamageService.Save(invDamage);

                        //int DamageId = Convert.ToInt32(objOperation.OperationId);

                        //foreach (var item in Detail)
                        //{
                        //    InvDamageDetail objInvDamageDetail = _IDamageDetailService.GetById(item.Id);
                        //    if (objInvDamageDetail != null)
                        //    {
                        //        objInvDamageDetail.InvDamageId= invDamage.Id;
                        //        objInvDamageDetail.SlsProductId = item.SlsProductId;
                        //        objInvDamageDetail.Quantity = item.Quantity;
                        //        objInvDamageDetail.Reason = item.Reason;
                        //        objInvDamageDetail.SlsUnitsId = item.SlsUnitsId;
                        //        _IDamageDetailService.Update(objInvDamageDetail);
                        //    }
                        //    else
                        //    {
                        //        objInvDamageDetail = new InvDamageDetail();
                        //        objInvDamageDetail.InvDamageId = DamageId;
                        //        objInvDamageDetail.SlsProductId = item.SlsProductId;
                        //        objInvDamageDetail.Quantity = item.Quantity;
                        //        objInvDamageDetail.Reason = item.Reason;
                        //        objInvDamageDetail.SlsUnitsId = item.SlsUnitsId;
                        //        _IDamageDetailService.Save(objInvDamageDetail);
                        //    }

                        //}

                    }

                }
                else
                {
                    //if ((bool)Session["Edit"])
                    //{
                    //    invDamage.SecCompanyId = companyId;
                    //    invDamage.ModifiedBy = userId;
                    //    invDamage.ModifiedDate = DateTime.Now;
                    //    objOperation = _IDamageService.Update(invDamage);

                    //    foreach (var item in Detail)
                    //    {
                    //        InvDamageDetail objInvDamageDetail = _IDamageDetailService.GetById(item.Id);
                    //        if (objInvDamageDetail != null)
                    //        {
                    //            objInvDamageDetail.InvDamageId = invDamage.Id;
                    //            objInvDamageDetail.SlsProductId = item.SlsProductId;
                    //            objInvDamageDetail.Quantity = item.Quantity;
                    //            objInvDamageDetail.Reason = item.Reason;
                    //            objInvDamageDetail.SlsUnitsId = item.SlsUnitsId;
                    //            _IDamageDetailService.Update(objInvDamageDetail);
                    //        }
                    //        else
                    //        {
                    //            objInvDamageDetail = new InvDamageDetail();
                    //            objInvDamageDetail.InvDamageId = invDamage.Id;
                    //            objInvDamageDetail.SlsProductId = item.SlsProductId;
                    //            objInvDamageDetail.Quantity = item.Quantity;
                    //            objInvDamageDetail.Reason = item.Reason;
                    //            objInvDamageDetail.SlsUnitsId = item.SlsUnitsId;
                    //            _IDamageDetailService.Save(objInvDamageDetail);
                    //        }

                    //    }

                    //}

                }

                //objOperation = _IDamageService.Commit();
            }

            return Json(objOperation, JsonRequestBehavior.DenyGet);
        }
コード例 #3
0
        public static InvDamage MapToInvDamage(InvDamageRequestViewModel obj)
        {
            InvDamage model = new InvDamage();

            model.Id = obj.Id;
            model.RefNo = obj.RefNo;
            model.SecCompanyId = obj.SecCompanyId;

            model.CreatedBy = obj.CreatedBy;
            model.CreatedDate = obj.CreatedDate;
            model.ModifiedBy = obj.ModifiedBy;

            model.ModifiedDate = obj.ModifiedDate;

            return model;
        }