Beispiel #1
0
        public ActionResult Index(IndexViewModel vm, int?PageIndex)
        {
            vm.searchCondition = new SearchCondition();
            var CustomerListAll = ApplicationConfigHelper.GetProjectUserCustomers(base.UserInfo.ProjectID, base.UserInfo.ID).Where(t => t.StoreType == 2 || t.StoreType == 3);
            var ProjectList     = CustomerListAll.Select(t => new { Value = t.ProjectID, Text = t.ProjectName }).Distinct().Select(c => new SelectListItem()
            {
                Value = c.Value.ToString(), Text = c.Text
            });
            var CustomerList = CustomerListAll.Select(c => new SelectListItem()
            {
                Value = c.CustomerID.ToString(), Text = c.CustomerName
            });

            ViewBag.CustomerList = CustomerList;
            ViewBag.ProjectList  = ProjectList;
            GetTemplateByConditionRequest getTemplateByConditionRequest = new GetTemplateByConditionRequest();

            getTemplateByConditionRequest.SearchCondition = vm.searchCondition;
            getTemplateByConditionRequest.PageSize        = UtilConstants.PAGESIZE;
            getTemplateByConditionRequest.PageIndex       = PageIndex ?? 0;
            var getTemplateByConditionResponse = new TemplateManagementService().GetTemplateByCondition(getTemplateByConditionRequest);

            if (getTemplateByConditionResponse.IsSuccess)
            {
                vm.TemplateCollection = getTemplateByConditionResponse.Result.TemplateCollection;
                vm.PageIndex          = getTemplateByConditionResponse.Result.PageIndex;
                vm.PageCount          = getTemplateByConditionResponse.Result.PageCount;
            }
            return(View(vm));
        }
        public string EditTemplateDetail(GetTemplateByConditionRequest rece)
        {
            using (SqlConnection conn = new SqlConnection(BaseAccessor._dataBase.ConnectionString))
            {
                string message = "";
                try
                {
                    IList <Receipt>       result        = new List <Receipt>();
                    IList <ReceiptDetail> receiptDetail = new List <ReceiptDetail>();
                    SqlCommand            cmd           = new SqlCommand("Proc_WMS_EditTemplateDetail", conn);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@Templates", rece.tableColumns.Select(m => new WMSTemplateToDb(m)));
                    cmd.Parameters[0].SqlDbType = SqlDbType.Structured;
                    cmd.Parameters.AddWithValue("@ProjectID", rece.SearchCondition.ProjectID);
                    cmd.Parameters[1].SqlDbType = SqlDbType.BigInt;
                    cmd.Parameters.AddWithValue("@CustomerID", rece.SearchCondition.CustomerID);
                    cmd.Parameters[2].SqlDbType = SqlDbType.BigInt;
                    cmd.Parameters.AddWithValue("@TableName", rece.SearchCondition.TableName);
                    cmd.Parameters[3].SqlDbType = SqlDbType.NVarChar;
                    cmd.Parameters[3].Size      = 100;
                    cmd.Parameters.AddWithValue("@message", message);
                    cmd.Parameters[4].SqlDbType = SqlDbType.NVarChar;
                    cmd.Parameters[4].Direction = ParameterDirection.Output;
                    cmd.Parameters[4].Size      = 100;
                    cmd.CommandTimeout          = 300;
                    conn.Open();

                    DataSet        ds  = new DataSet();
                    SqlDataAdapter sda = new SqlDataAdapter();
                    sda.SelectCommand = cmd;
                    sda.Fill(ds);
                    message = sda.SelectCommand.Parameters["@message"].Value.ToString();
                    conn.Close();
                    return(message);
                }
                catch (Exception ex)
                {
                    return(message + "(" + ex.Message + ")");
                }
            }
        }
Beispiel #3
0
        public ActionResult TemplateCreate(string TableName, string TableNameCH, string ProjectName, string CustomerName, long ProjectID = 0, long CustomerID = 0)
        {
            IndexViewModel vm = new IndexViewModel();

            vm.searchCondition              = new SearchCondition();
            vm.searchCondition.ProjectID    = ProjectID;
            vm.searchCondition.CustomerID   = CustomerID;
            vm.searchCondition.ProjectName  = ProjectName;
            vm.searchCondition.CustomerName = CustomerName;
            vm.searchCondition.TableName    = TableName;
            vm.searchCondition.TableNameCH  = TableNameCH;
            GetTemplateByConditionRequest getTemplateByConditionRequest = new GetTemplateByConditionRequest();

            getTemplateByConditionRequest.SearchCondition = vm.searchCondition;
            var getTemplateDetailByConditionResponse = new TemplateManagementService().GetTemplateDetailByCondition(getTemplateByConditionRequest);

            if (getTemplateDetailByConditionResponse.IsSuccess)
            {
                vm.TemplateCollection = getTemplateDetailByConditionResponse.Result.TemplateCollection;
            }
            return(View(vm));
        }
        public Response <string> EditTemplateDetail(GetTemplateByConditionRequest request)
        {
            Response <string> response = new Response <string>();
            string            message  = "";

            if (request == null || request.tableColumns == null || !request.tableColumns.Any())
            {
                ArgumentNullException ex = new ArgumentNullException("EditTemplateDetail request");
                LogError(ex);
                response.ErrorCode = ErrorCode.Argument;
                response.Exception = ex;
                return(response);
            }
            try
            {
                message = new TemplateManagementAccessor().EditTemplateDetail(request);
                if (message == "更新成功" || message == "")
                {
                    response.Result    = message;
                    response.IsSuccess = true;
                }
                else
                {
                    response.Result    = message;
                    response.IsSuccess = false;
                }
                return(response);
            }
            catch (Exception ex)
            {
                LogError(ex);
                response.IsSuccess = false;
                response.ErrorCode = ErrorCode.Technical;
                response.Result    = message + ex.Message;
            }

            return(response);
        }
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public Response <GetTemplateByConditionResponse> GetTemplateByCondition(GetTemplateByConditionRequest request)
        {
            Response <GetTemplateByConditionResponse> response = new Response <GetTemplateByConditionResponse>()
            {
                Result = new GetTemplateByConditionResponse()
            };

            if (request == null || request.SearchCondition == null)
            {
                ArgumentNullException ex = new ArgumentNullException("GetTemplateByConditionRequest request");
                LogError(ex);
                response.ErrorCode = ErrorCode.Argument;
                response.Exception = ex;
                return(response);
            }

            try
            {
                TemplateManagementAccessor accessor = new TemplateManagementAccessor();
                int RowCount;
                if (request.PageSize > 0)
                {
                    response.Result.TemplateCollection = accessor.GetTemplateByCondition(request.SearchCondition, request.PageIndex, request.PageSize, out RowCount);
                    response.Result.PageCount          = RowCount % request.PageSize == 0 ? RowCount / request.PageSize : RowCount / request.PageSize + 1;
                    response.Result.PageIndex          = request.PageIndex;
                }
                response.IsSuccess = true;
            }
            catch (Exception ex)
            {
                LogError(ex);
                response.Exception = ex;
                response.IsSuccess = false;
                response.ErrorCode = ErrorCode.Technical;
            }

            return(response);
        }
Beispiel #6
0
        public string TemplateCreate(string jsonString, long ProjectID, long CustomerID, string TableName)
        {
            string s = "";
            JavaScriptSerializer          Serializer = new JavaScriptSerializer();
            List <TableColumn>            objs       = Serializer.Deserialize <List <TableColumn> >(jsonString);
            GetTemplateByConditionRequest getTemplateByConditionRequest = new GetTemplateByConditionRequest();

            getTemplateByConditionRequest.tableColumns = objs;
            SearchCondition serch = new SearchCondition();

            serch.ProjectID  = ProjectID;
            serch.CustomerID = CustomerID;
            serch.TableName  = TableName;
            getTemplateByConditionRequest.SearchCondition = serch;
            var Responses = new TemplateManagementService().EditTemplateDetail(getTemplateByConditionRequest);

            if (Responses.IsSuccess)
            {
                s = Responses.Result;
                ApplicationConfigHelper.RefreshGetApplicationConfigNew(ProjectID, CustomerID);
            }
            return(s);
        }
        public Response <GetTemplateByConditionResponse> GetTemplateDetailByCondition(GetTemplateByConditionRequest request)
        {
            Response <GetTemplateByConditionResponse> response = new Response <GetTemplateByConditionResponse>()
            {
                Result = new GetTemplateByConditionResponse()
            };

            if (request == null || request.SearchCondition == null)
            {
                ArgumentNullException ex = new ArgumentNullException("GetTemplateDetailByCondition request");
                LogError(ex);
                response.ErrorCode = ErrorCode.Argument;
                response.Exception = ex;
                return(response);
            }

            try
            {
                TemplateManagementAccessor accessor = new TemplateManagementAccessor();

                response.Result.TemplateCollection = accessor.GetTemplateDetailByCondition(request.SearchCondition);

                response.IsSuccess = true;
            }
            catch (Exception ex)
            {
                LogError(ex);
                response.Exception = ex;
                response.IsSuccess = false;
                response.ErrorCode = ErrorCode.Technical;
            }

            return(response);
        }