コード例 #1
0
        public ActionResult Edit(int id)
        {
            cust_chukujihuamx tempData = ob_cust_chukujihuamxservice.GetEntityById(cust_chukujihuamx => cust_chukujihuamx.ID == id && cust_chukujihuamx.IsDelete == false);

            ViewBag.cust_chukujihuamx = tempData;
            if (tempData == null)
            {
                return(View());
            }
            else
            {
                cust_chukujihuamxViewModel cust_chukujihuamxviewmodel = new cust_chukujihuamxViewModel();
                cust_chukujihuamxviewmodel.ID          = tempData.ID;
                cust_chukujihuamxviewmodel.JihuaID     = tempData.JihuaID;
                cust_chukujihuamxviewmodel.ShangpinID  = tempData.ShangpinID;
                cust_chukujihuamxviewmodel.ShangpinMC  = tempData.ShangpinMC;
                cust_chukujihuamxviewmodel.Zhucezheng  = tempData.Zhucezheng;
                cust_chukujihuamxviewmodel.Guige       = tempData.Guige;
                cust_chukujihuamxviewmodel.Pihao       = tempData.Pihao;
                cust_chukujihuamxviewmodel.Pihao1      = tempData.Pihao1;
                cust_chukujihuamxviewmodel.Xuliema     = tempData.Xuliema;
                cust_chukujihuamxviewmodel.ShengchanRQ = tempData.ShengchanRQ;
                cust_chukujihuamxviewmodel.ShiXiaoRQ   = tempData.ShiXiaoRQ;
                cust_chukujihuamxviewmodel.JihuaSL     = tempData.JihuaSL;
                cust_chukujihuamxviewmodel.ChukuSL     = tempData.ChukuSL;
                cust_chukujihuamxviewmodel.JibenDW     = tempData.JibenDW;
                cust_chukujihuamxviewmodel.BaozhuangDW = tempData.BaozhuangDW;
                cust_chukujihuamxviewmodel.Huansuanlv  = tempData.Huansuanlv;
                cust_chukujihuamxviewmodel.Changjia    = tempData.Changjia;
                cust_chukujihuamxviewmodel.Chandi      = tempData.Chandi;
                cust_chukujihuamxviewmodel.Beizhu      = tempData.Beizhu;
                cust_chukujihuamxviewmodel.Col1        = tempData.Col1;
                cust_chukujihuamxviewmodel.Col2        = tempData.Col2;
                cust_chukujihuamxviewmodel.Col3        = tempData.Col3;
                cust_chukujihuamxviewmodel.MakeDate    = tempData.MakeDate;
                cust_chukujihuamxviewmodel.MakeMan     = tempData.MakeMan;
                cust_chukujihuamxviewmodel.ShangpinDM  = tempData.ShangpinDM;
                return(View(cust_chukujihuamxviewmodel));
            }
        }
コード例 #2
0
        public ActionResult Update()
        {
            string id          = Request["id"] ?? "";
            string jihuaid     = Request["jihuaid"] ?? "";
            string shangpinid  = Request["shangpinid"] ?? "";
            string shangpinmc  = Request["shangpinmc"] ?? "";
            string zhucezheng  = Request["zhucezheng"] ?? "";
            string guige       = Request["guige"] ?? "";
            string pihao       = Request["pihao"] ?? "";
            string pihao1      = Request["pihao1"] ?? "";
            string xuliema     = Request["xuliema"] ?? "";
            string shengchanrq = Request["shengchanrq"] ?? "";
            string shixiaorq   = Request["shixiaorq"] ?? "";
            string jihuasl     = Request["jihuasl"] ?? "";
            string chukusl     = Request["chukusl"] ?? "";
            string jibendw     = Request["jibendw"] ?? "";
            string baozhuangdw = Request["baozhuangdw"] ?? "";
            string huansuanlv  = Request["huansuanlv"] ?? "";
            string changjia    = Request["changjia"] ?? "";
            string chandi      = Request["chandi"] ?? "";
            string beizhu      = Request["beizhu"] ?? "";
            string col1        = Request["col1"] ?? "";
            string col2        = Request["col2"] ?? "";
            string col3        = Request["col3"] ?? "";
            string makedate    = Request["makedate"] ?? "";
            string makeman     = Request["makeman"] ?? "";
            string shangpindm  = Request["shangpindm"] ?? "";
            int    uid         = int.Parse(id);

            try
            {
                cust_chukujihuamx p = ob_cust_chukujihuamxservice.GetEntityById(cust_chukujihuamx => cust_chukujihuamx.ID == uid);
                p.JihuaID     = jihuaid == "" ? 0 : int.Parse(jihuaid);
                p.ShangpinID  = shangpinid == "" ? 0 : int.Parse(shangpinid);
                p.ShangpinMC  = shangpinmc.Trim();
                p.Zhucezheng  = zhucezheng.Trim();
                p.Guige       = guige.Trim();
                p.Pihao       = pihao.Trim();
                p.Pihao1      = pihao1.Trim();
                p.Xuliema     = xuliema.Trim();
                p.ShengchanRQ = shengchanrq == "" ? DateTime.Now : DateTime.Parse(shengchanrq);
                p.ShiXiaoRQ   = shixiaorq == "" ? DateTime.Now : DateTime.Parse(shixiaorq);
                p.JihuaSL     = jihuasl == "" ? 0 : float.Parse(jihuasl);
                p.ChukuSL     = chukusl == "" ? 0 : float.Parse(chukusl);
                p.JibenDW     = jibendw.Trim();
                p.BaozhuangDW = baozhuangdw.Trim();
                p.Huansuanlv  = huansuanlv == "" ? 0 : float.Parse(huansuanlv);
                p.Changjia    = changjia.Trim();
                p.Chandi      = chandi.Trim();
                p.Beizhu      = beizhu.Trim();
                p.Col1        = col1.Trim();
                p.Col2        = col2.Trim();
                p.Col3        = col3.Trim();
                p.MakeDate    = makedate == "" ? DateTime.Now : DateTime.Parse(makedate);
                p.MakeMan     = makeman == "" ? 0 : int.Parse(makeman);
                p.ShangpinDM  = shangpindm.Trim();
                ob_cust_chukujihuamxservice.UpdateEntity(p);
                ViewBag.saveok = ViewAddTag.ModifyOk;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                ViewBag.saveok = ViewAddTag.ModifyNo;
            }
            return(RedirectToAction("Index"));
        }