public ActionResult New(ProductLineMap productLineMap)
 {
     if (ModelState.IsValid)
     {
         //判断描述不能重复
         try
         {
             var hasError = Validate(productLineMap);
             if (!hasError)
             {
                 if (base.genericMgr.FindAll<long>(CodeDuiplicateVerifyStatement, new object[] { productLineMap.SAPProductLine })[0] > 0)
                 {
                     base.SaveErrorMessage(Resources.CUST.ProductLineMap.ProductLineMap_Added_Existing_Code, productLineMap.SAPProductLine);
                 }
                 else
                 {
                     productLineMap.Type = Sconit.CodeMaster.ProductLineMapType.Van;
                     base.genericMgr.Create(productLineMap);
                     SaveSuccessMessage(Resources.CUST.ProductLineMap.ProductLineMap_Added);
                     return RedirectToAction("Edit", new { SAPProductLine = productLineMap.SAPProductLine });
                 }
             }
         }
         catch (System.Exception ex)
         {
             SaveErrorMessage(ex.Message);
         }
     }
     return View(productLineMap);
 }
        public ActionResult Edit(GridCommand command, ProductLineMap productLineMap)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var hasError = Validate(productLineMap);
                    if (!hasError)
                    {
                        productLineMap.Type = Sconit.CodeMaster.ProductLineMapType.Van;
                        base.genericMgr.Update(productLineMap);
                        SaveSuccessMessage(Resources.CUST.ProductLineMap.ProductLineMap_Added);
                        return RedirectToAction("Edit", new { SAPProductLine = productLineMap.SAPProductLine });
                    }
                }
                catch (System.Exception ex)
                {

                    SaveErrorMessage(ex.Message);
                }
            }
            return View(productLineMap);
        }
 private bool Validate(ProductLineMap productLineMap)
 {
     var hasError = false;
     if (string.IsNullOrWhiteSpace(productLineMap.TransmissionFlow))
     {
         hasError = true;
         SaveErrorMessage(Resources.ErrorMessage.Errors_Common_FieldRequired, Resources.CUST.ProductLineMap.ProductLineMap_TransmissionFlow);
     }
     if (string.IsNullOrWhiteSpace(productLineMap.SaddleFlow))
     {
         hasError = true;
         SaveErrorMessage(Resources.ErrorMessage.Errors_Common_FieldRequired, Resources.CUST.ProductLineMap.ProductLineMap_SaddleFlow);
     }
     if (string.IsNullOrWhiteSpace(productLineMap.CabProdLine))
     {
         hasError = true;
         SaveErrorMessage(Resources.ErrorMessage.Errors_Common_FieldRequired, Resources.CUST.ProductLineMap.ProductLineMap_CabProdLine);
     }
     if (string.IsNullOrWhiteSpace(productLineMap.ChassisProdLine))
     {
         hasError = true;
         SaveErrorMessage(Resources.ErrorMessage.Errors_Common_FieldRequired, Resources.CUST.ProductLineMap.ProductLineMap_ChassisProdLine);
     }
     if (string.IsNullOrWhiteSpace(productLineMap.AssemblyProdLine))
     {
         hasError = true;
         SaveErrorMessage(Resources.ErrorMessage.Errors_Common_FieldRequired, Resources.CUST.ProductLineMap.ProductLineMap_AssemblyProdLine);
     }
     if (string.IsNullOrWhiteSpace(productLineMap.SpecialProdLine))
     {
         hasError = true;
         SaveErrorMessage(Resources.ErrorMessage.Errors_Common_FieldRequired, Resources.CUST.ProductLineMap.ProductLineMap_SpecialProdLine);
     }
     if (productLineMap.MaxOrderCount < 0)
     {
         hasError = true;
         SaveErrorMessage(Resources.CUST.ProductLineMap.ProductLineMap_SpecialProdLine + "不能小于0");
     }
     if (string.IsNullOrWhiteSpace(productLineMap.InitialVanOrder))
     {
         hasError = true;
         SaveErrorMessage(Resources.ErrorMessage.Errors_Common_FieldRequired, Resources.CUST.ProductLineMap.ProductLineMap_InitialVanOrder);
     }
     if (string.IsNullOrWhiteSpace(productLineMap.Plant))
     {
         hasError = true;
         SaveErrorMessage(Resources.ErrorMessage.Errors_Common_FieldRequired, Resources.CUST.ProductLineMap.ProductLineMap_Plant);
     }
     return hasError;
 }
 private bool Validate(ProductLineMap productLineMap)
 {
     var hasError = false;
     if (string.IsNullOrWhiteSpace(productLineMap.ProductLine))
     {
         hasError = true;
         SaveErrorMessage(Resources.ErrorMessage.Errors_Common_FieldRequired, Resources.CUST.ProductLineMap.ProductLineMap_ProductLine);
     }
     if (string.IsNullOrWhiteSpace(productLineMap.Plant))
     {
         hasError = true;
         SaveErrorMessage(Resources.ErrorMessage.Errors_Common_FieldRequired, Resources.CUST.ProductLineMap.ProductLineMap_Plant);
     }
     return hasError;
 }