Beispiel #1
0
        public ActionResult SaveModify(MaterialReceiptExViewModel model)
        {
            MethodReturnResult result = new MethodReturnResult();

            using (MaterialReceiptServiceClient client = new MaterialReceiptServiceClient())
            {
                MaterialReceipt MaterialReceipt = new MaterialReceipt()
                {
                    Key         = model.ReceiptNo,
                    ReceiptDate = model.ReceiptDate,
                    OrderNumber = model.OrderNumber,
                    Description = model.Description,
                    LineStore   = model.LineStore,
                    Creator     = model.Creator,
                    Editor      = User.Identity.Name
                };

                result = client.ModifyMaterialReceipt(MaterialReceipt);

                if (result.Code == 0)
                {
                    result.Message = string.Format(LSMResources.StringResource.MaterialReceipt_Save_Success, model.ReceiptNo);
                }
            }
            return(Json(result));
        }
Beispiel #2
0
        public ActionResult Modify(string key)
        {
            MaterialReceiptExViewModel model = new MaterialReceiptExViewModel();

            using (MaterialReceiptServiceClient client = new MaterialReceiptServiceClient())
            {
                MethodReturnResult <MaterialReceipt> result = client.Get(key);
                if (result.Code == 0)
                {
                    model = new MaterialReceiptExViewModel()
                    {
                        ReceiptNo   = result.Data.Key,
                        ReceiptDate = result.Data.ReceiptDate,
                        OrderNumber = result.Data.OrderNumber,
                        LineStore   = result.Data.LineStore,
                        Creator     = result.Data.Creator,
                        Editor      = User.Identity.Name
                    };
                    return(PartialView("_ModifyPartial", model));
                }
                else
                {
                    ModelState.AddModelError("", result.Message);
                }
            }

            return(PartialView("_ModifyPartial"));
        }
Beispiel #3
0
        public ActionResult Save(MaterialReceiptExViewModel model)
        {
            MethodReturnResult result = new MethodReturnResult();

            try
            {
                using (MaterialReceiptServiceClient client = new MaterialReceiptServiceClient())
                {
                    MethodReturnResult <MaterialReceipt> resultOfAddMaterial = new MethodReturnResult <MaterialReceipt>();

                    MaterialReceipt materialReceipt = new MaterialReceipt()
                    {
                        Key         = model.ReceiptNo,
                        ReceiptDate = model.ReceiptDate,
                        Description = model.Description,
                        OrderNumber = model.OrderNumber,
                        LineStore   = model.LineStore,
                        Editor      = User.Identity.Name,
                        Creator     = User.Identity.Name,
                    };

                    resultOfAddMaterial = client.AddMaterialReceipt(materialReceipt);

                    if (resultOfAddMaterial.Code == 0)
                    {
                        result.Message = string.Format(LSMResources.StringResource.MaterialReceipt_Save_Success
                                                       , resultOfAddMaterial.Data.Key);
                        result.Detail = resultOfAddMaterial.Data.Key;
                    }
                    else
                    {
                        result.Code    = resultOfAddMaterial.Code;
                        result.Message = resultOfAddMaterial.Message;
                    }
                }
            }
            catch (Exception ex)
            {
                result.Code    = 1000;
                result.Message = ex.Message;
                result.Detail  = ex.ToString();
            }
            return(Json(result));
        }