Beispiel #1
0
        public void Save(T_XSMXModels model)
        {
            int    result = 0;
            string guid   = string.Empty;

            try
            {
                if (model.Tag == "Add")
                {
                    model.DataModel.GUID = Guid.NewGuid().ToString("N");
                    guid   = model.DataModel.GUID;
                    result = T_XSMXDomain.GetInstance().AddModelByXsdh(model.DataModel, model.XSDH);
                }
                else if (model.Tag == "Edit")
                {
                    result = T_XSMXDomain.GetInstance().UpdateModel(model.DataModel, model.DataModel.MXID);
                }
            }
            catch { }
            Response.ContentType = "text/json";
            if (result > 0)
            {
                string resultStr = JsonConvert.SerializeObject(new { statusCode = "200", message = "操作成功", guid = guid });
                Response.Write(resultStr);
            }
            //Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"closeCurrentReloadTab\",\"forwardUrl\":\"/T_XSD/Index\"}");
            else
            {
                Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}");
            }
        }
Beispiel #2
0
        public ActionResult Index(T_XSMXModels evalModel, string id)
        {
            try
            {
                evalModel.currentPage = int.Parse(Request["pageNum"].ToString());
            }
            catch { }
            string order = "";

            try
            {
                order = Request["orderField"].ToString();
            }
            catch { }

            if (order.Trim() == "${param.orderField}")
            {
                order = "";
            }
            ViewBag.XSDID = id;
            int pagesize    = Convert.ToInt32(evalModel.pageSize);
            int pagecount   = Convert.ToInt32(evalModel.pagecount);
            int currentPage = Convert.ToInt32(evalModel.currentPage);

            evalModel.DataModel   = evalModel.DataModel ?? new T_XSMX();
            evalModel.DataList    = T_XSMXDomain.GetInstance().PageT_XSMX(evalModel.DataModel, evalModel.StartTime, evalModel.EndTime, currentPage, pagesize, out pagecount, out resultCount).Where(p => p.XSID == int.Parse(id)).ToList();
            evalModel.resultCount = resultCount;
            return(View("~/Views/T_XSMX/Index.cshtml", evalModel));
        }
Beispiel #3
0
        public ActionResult Save(System.Int32 id, string tag)
        {
            T_XSMXModels model = new T_XSMXModels();

            model.DataModel = new T_XSMX();
            Int32 did = id;

            if (tag != "Add")
            {
                model.DataModel = T_XSMXDomain.GetInstance().GetModelById(id);
                did             = model.DataModel.XSID ?? 0;
            }
            //加载销售单列表
            T_XSDModels xsdmode = new T_XSDModels();

            xsdmode.DataModel = xsdmode.DataModel ?? new T_XSD();

            // xsdmode.DataList = T_XSDDomain.GetInstance().GetAllT_XSD(xsdmode.DataModel);



            //加载产品列表
            T_YLCPModels ylcpmode = new T_YLCPModels();

            ylcpmode.DataModel = ylcpmode.DataModel ?? new T_YLCP();

            ylcpmode.DataList = T_YLCPDomain.GetInstance().GetAllT_YLCP(ylcpmode.DataModel).Where(p => p.CPStatus == Convert.ToInt32("1")).ToList();

            ViewData["YLCP"] = new SelectList(ylcpmode.DataList, "CPID", "CPMC");



            T_XSD rkd = T_XSDDomain.GetInstance().GetModelById(did);

            xsdmode.DataList = new List <T_XSD>();
            xsdmode.DataList.Add(rkd);
            ViewData["XSD"] = new SelectList(xsdmode.DataList, "XSID", "XSMC");


            //if (id != 0)
            //{
            //    model.DataModel = T_XSMXDomain.GetInstance().GetModelById(id);
            //}
            model.Tag = tag;
            return(View("~/Views/T_XSMX/Save.cshtml", model));
        }
Beispiel #4
0
        public int resultCount = 0; // 总条数
        // GET: T_XSHZ
        public ActionResult Index(T_XSMXModels evalModel)
        {
            try
            {
                evalModel.currentPage = int.Parse(Request["pageNum"].ToString());
            }
            catch { }
            string order = "";
            string qyid  = "";

            try
            {
                order = Request["orderField"].ToString();
            }
            catch { }
            if (order.Trim() == "${param.orderField}")
            {
                order = "";
            }
            evalModel.DataModel        = evalModel.DataModel ?? new T_XSMX();
            evalModel.DataModel.T_YLCP = evalModel.DataModel.T_YLCP ?? new T_YLCP();

            //加载产品生产企业
            T_SupQYModels qymode = new T_SupQYModels();

            qymode.DataModel = qymode.DataModel ?? new T_SupQY();
            qymode.DataList  = T_SupQYDomain.GetInstance().GetAllT_SupQY(qymode.DataModel);
            ViewData["QY"]   = new SelectList(qymode.DataList, "SupID", "SupMC");
            if (Request["QYList"] != null)
            {
                qyid = Request["QYList"].ToString();
                if (!String.IsNullOrEmpty(qyid))
                {
                    T_SupQY qycp = new T_SupQY();
                    qycp.SupID = int.Parse(qyid);
                    evalModel.DataModel.T_YLCP.T_SupQY1 = qycp;
                }
            }
            ViewData["QYList"] = qyid;

            Expression <Func <T_YLCP, bool> > where = PredicateBuilder.True <T_YLCP>();
            var lst = T_YLCPDomain.GetInstance().GetAllModels <int>(where);

            ViewData["XSHZ_YLCP"] = new SelectList(lst, "CPID", "CPMC");
            var cpid = "";

            if (Request["XSHZ_CPID"] != null)
            {
                cpid = Request["XSHZ_CPID"].ToString();
                if (!String.IsNullOrEmpty(cpid))
                {
                    evalModel.DataModel.CPID = int.Parse(cpid);
                }
            }
            ViewData["XSHZ_CPID"] = cpid;

            int pagesize    = Convert.ToInt32(evalModel.pageSize);
            int pagecount   = Convert.ToInt32(evalModel.pagecount);
            int currentPage = Convert.ToInt32(evalModel.currentPage);

            evalModel.DataModel   = evalModel.DataModel ?? new T_XSMX();
            evalModel.DataList    = T_XSMXDomain.GetInstance().PageT_XSMX(evalModel.DataModel, evalModel.StartTime, evalModel.EndTime, currentPage, pagesize, out pagecount, out resultCount);
            evalModel.resultCount = resultCount;

            var totalNum = 0;

            if (evalModel.DataList != null && evalModel.DataList.Count > 0)
            {
                evalModel.DataList.ForEach(p =>
                {
                    totalNum += (p.CPSL ?? 0);
                });
            }
            ViewBag.TotalNum = totalNum;
            return(View("~/Views/T_XSHZ/Index.cshtml", evalModel));
        }