示例#1
0
        /// <summary>
        /// 插入客户信息历史记录,若更换的是CVT,则修改客户信息中对应的车架号的CVT编号
        /// </summary>
        /// <param name="serviceID">反馈单号</param>
        /// <param name="vehicleShelfNumber">车架号</param>
        /// <param name="cvtType">变速箱型号</param>
        /// <param name="carModel">车型</param>
        /// <param name="clientName">客户名称</param>
        /// <param name="dealerName">经销商名称</param>
        /// <param name="replaceAccessoryList">更换件列表</param>
        /// <param name="error">错误信息</param>
        /// <returns>操作成功返回True,操作失败返回False</returns>
        public bool InsertCustomerHistoryInfo(string serviceID, string vehicleShelfNumber, string cvtType, string carModel, string clientName, string dealerName,
                                              DataTable replaceAccessoryList, out string error)
        {
            error = null;

            try
            {
                DepotManagementDataContext dataContext = CommentParameter.DepotDataContext;

                for (int i = 0; i < replaceAccessoryList.Rows.Count; i++)
                {
                    YX_CVTCustomerInformationHistory lnqCustomerHistory = new YX_CVTCustomerInformationHistory();

                    lnqCustomerHistory.CarModel        = carModel;
                    lnqCustomerHistory.ClientName      = clientName;
                    lnqCustomerHistory.CVTType         = cvtType;
                    lnqCustomerHistory.DealerName      = dealerName;
                    lnqCustomerHistory.FinishDate      = ServerTime.Time;
                    lnqCustomerHistory.FinishPersonnel = BasicInfo.LoginName;

                    lnqCustomerHistory.NewPartCode = replaceAccessoryList.Rows[i]["NewGoodsID"].ToString().Trim() == "" ?
                                                     replaceAccessoryList.Rows[i]["NewCvtID"].ToString().Trim() :
                                                     replaceAccessoryList.Rows[i]["NewGoodsID"].ToString().Trim();

                    lnqCustomerHistory.OldPartCode = replaceAccessoryList.Rows[i]["OldGoodsID"].ToString().Trim() == "" ?
                                                     replaceAccessoryList.Rows[i]["OldCvtID"].ToString().Trim() :
                                                     replaceAccessoryList.Rows[i]["OldGoodsID"].ToString().Trim();

                    lnqCustomerHistory.ReplaceCode        = replaceAccessoryList.Rows[i]["OldGoodsCode"].ToString();
                    lnqCustomerHistory.ReplaceName        = replaceAccessoryList.Rows[i]["OldGoodsName"].ToString();
                    lnqCustomerHistory.ReplaceSpec        = replaceAccessoryList.Rows[i]["OldSpec"].ToString();
                    lnqCustomerHistory.VehicleShelfNumber = vehicleShelfNumber;

                    lnqCustomerHistory.Remark = "由单号为【" + serviceID + "】售后反馈单,自动生成";

                    dataContext.YX_CVTCustomerInformationHistory.InsertOnSubmit(lnqCustomerHistory);

                    IProductListServer serverProductList = ServerModuleFactory.GetServerModule <IProductListServer>();

                    int intGoodsID = serverProductList.GetProductGoodsID(replaceAccessoryList.Rows[i]["OldGoodsCode"].ToString(), 0, true);

                    if (intGoodsID != 0)
                    {
                        var varData = from a in dataContext.YX_CVTCustomerInformation
                                      where a.VehicleShelfNumber == vehicleShelfNumber
                                      select a;

                        if (varData.Count() == 1)
                        {
                            YX_CVTCustomerInformation lnqCustomerInfo = varData.Single();

                            lnqCustomerInfo.ProductID = intGoodsID;
                            lnqCustomerInfo.CVTNumber = replaceAccessoryList.Rows[i]["NewCvtID"].ToString().Trim();
                        }
                        else
                        {
                            error = "车架号在客户信息内不唯一或者不存在";
                            return(false);
                        }
                    }
                }

                dataContext.SubmitChanges();

                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
示例#2
0
        /// <summary>
        /// 更改数据CVT客户基础信息
        /// </summary>
        /// <param name="cvtCustomer">CVT客户信息</param>
        /// <param name="error">c错误信息</param>
        /// <returns>更改成功返回True,更改失败返回False</returns>
        public bool UpdateCVTCustomerInformation(YX_CVTCustomerInformation cvtCustomer, out string error)
        {
            error = null;

            try
            {
                DepotManagementDataContext dataContext = CommentParameter.DepotDataContext;

                var varData = from a in dataContext.YX_CVTCustomerInformation
                              where a.ID != cvtCustomer.ID &&
                              a.VehicleShelfNumber == cvtCustomer.VehicleShelfNumber
                              select a;

                if (varData.Count() != 0)
                {
                    error = "数据不唯一";
                    return(false);
                }
                else
                {
                    var varCVT = from a in dataContext.YX_CVTCustomerInformation
                                 where a.ID == cvtCustomer.ID
                                 select a;

                    if (varCVT.Count() == 1)
                    {
                        YX_CVTCustomerInformation lnqCustomer = varCVT.Single();

                        lnqCustomer.CarModelID         = cvtCustomer.CarModelID;
                        lnqCustomer.ClientName         = cvtCustomer.ClientName;
                        lnqCustomer.CVTNumber          = cvtCustomer.CVTNumber;
                        lnqCustomer.DealerName         = cvtCustomer.DealerName;
                        lnqCustomer.FullAddress        = cvtCustomer.FullAddress;
                        lnqCustomer.PhoneNumber        = cvtCustomer.PhoneNumber;
                        lnqCustomer.ProductID          = cvtCustomer.ProductID;
                        lnqCustomer.Remark             = cvtCustomer.Remark;
                        lnqCustomer.SellDate           = cvtCustomer.SellDate;
                        lnqCustomer.SiteCity           = cvtCustomer.SiteCity;
                        lnqCustomer.SiteProvince       = cvtCustomer.SiteProvince;
                        lnqCustomer.VehicleShelfNumber = cvtCustomer.VehicleShelfNumber;
                        lnqCustomer.VKT           = cvtCustomer.VKT;
                        lnqCustomer.OverTheReason = cvtCustomer.OverTheReason;
                        lnqCustomer.ProofNo       = cvtCustomer.ProofNo;

                        var varInfo = from a in dataContext.YX_CVTCustomerInformation
                                      where a.VehicleShelfNumber == cvtCustomer.VehicleShelfNumber
                                      select a;

                        if (varInfo.Count() == 1)
                        {
                            YX_CVTCustomerInformation lnqInfo = varInfo.Single();


                            if (lnqInfo.CVTNumber != cvtCustomer.CVTNumber)
                            {
                                YX_CVTCustomerInformationHistory lnqCustomerHistory = new YX_CVTCustomerInformationHistory();

                                IProductListServer serverProcutList = ServerModuleFactory.GetServerModule <IProductListServer>();

                                lnqCustomerHistory.CarModel   = serverProcutList.GetMotorcycleInfo(Convert.ToInt32(cvtCustomer.CarModelID));
                                lnqCustomerHistory.ClientName = cvtCustomer.ClientName;

                                IBasicGoodsServer serverBasicGoods = ServerModuleFactory.GetServerModule <IBasicGoodsServer>();

                                F_GoodsPlanCost lnqGoods = serverBasicGoods.GetGoodsInfo(Convert.ToInt32(cvtCustomer.ProductID));

                                lnqCustomerHistory.CVTType            = lnqGoods.GoodsCode;
                                lnqCustomerHistory.DealerName         = cvtCustomer.DealerName;
                                lnqCustomerHistory.FinishDate         = ServerTime.Time;
                                lnqCustomerHistory.FinishPersonnel    = BasicInfo.LoginName;
                                lnqCustomerHistory.NewPartCode        = cvtCustomer.CVTNumber;
                                lnqCustomerHistory.OldPartCode        = lnqInfo.CVTNumber;
                                lnqCustomerHistory.Remark             = "手动修改";
                                lnqCustomerHistory.ReplaceCode        = lnqGoods.GoodsCode;
                                lnqCustomerHistory.ReplaceName        = lnqGoods.GoodsName;
                                lnqCustomerHistory.ReplaceSpec        = lnqGoods.Spec;
                                lnqCustomerHistory.VehicleShelfNumber = cvtCustomer.VehicleShelfNumber;

                                dataContext.YX_CVTCustomerInformationHistory.InsertOnSubmit(lnqCustomerHistory);
                            }
                        }
                    }
                }

                dataContext.SubmitChanges();
                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }