Esempio n. 1
0
        public AjaxResult UpdateProc([FromBody] dynamic Json)
        {
            #region                          //参数
            string stlGrd   = Json.stlGrd;   //钢种
            string spec     = Json.spec;     //规格
            string stdCode  = Json.stdCode;  //执行标准
            string desc     = Json.desc;     //用途
            string remark   = Json.remark;   //备注
            string procType = Json.procType; //产品类型
            string imgUrl   = Json.imgUrl;   //图片地址
            string id       = Json.id;       //产品ID
            #endregion

            #region //数据操作
            AjaxResult result = new AjaxResult();
            result.Code = DoResult.Success;
            Mod_TMB_PROC mod = new Mod_TMB_PROC();
            mod.C_STLGRD   = stlGrd;
            mod.C_SPEC     = spec;
            mod.C_STDCODE  = stdCode;
            mod.C_REMARK   = remark;
            mod.C_PROCTYPE = procType;
            mod.C_IMGURL   = imgUrl;
            mod.C_ID       = id;

            result.Result = JsonConvert.SerializeObject(tmb_proc.UpdateProc(mod));
            #endregion

            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// 添加产品
        /// </summary>
        /// <param name="mod">产品属性</param>
        /// <returns></returns>
        public bool AddProc(Mod_TMB_PROC mod)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("INSERT INTO TMB_PROC(C_STLGRD,C_SPEC,C_STDCODE,C_DESC,C_REMARK,C_PROCTYPE,C_IMGURL)");
            strSql.Append("VALUES(:C_STLGRD,:C_SPEC,:C_STDCODE,:C_DESC,:C_REMARK,:C_PROCTYPE,:C_IMGURL)");
            OracleParameter[] parameters =
            {
                new OracleParameter(":C_STLGRD",   OracleDbType.Varchar2,   100),
                new OracleParameter(":C_SPEC",     OracleDbType.Varchar2,   500),
                new OracleParameter(":C_STDCODE",  OracleDbType.Varchar2,   100),
                new OracleParameter(":C_DESC",     OracleDbType.Varchar2,   200),
                new OracleParameter(":C_REMARK",   OracleDbType.Varchar2,   500),
                new OracleParameter(":C_PROCTYPE", OracleDbType.NVarchar2, 1000),
                new OracleParameter(":C_IMGURL",   OracleDbType.Varchar2, 200)
            };
            parameters[0].Value = mod.C_STLGRD;
            parameters[1].Value = mod.C_SPEC;
            parameters[2].Value = mod.C_STDCODE;
            parameters[3].Value = mod.C_DESC;
            parameters[4].Value = mod.C_REMARK;
            parameters[5].Value = mod.C_PROCTYPE;
            parameters[6].Value = mod.C_IMGURL;
            int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string filetype    = Path.GetExtension(File1.PostedFile.FileName);
            string filename    = Path.GetFileNameWithoutExtension(File1.PostedFile.FileName); //文件名;
            string newfilename = filename + filetype;                                         //+
            string path        = "/Uploads/";

            Mod_TMB_PROC mod = new Mod_TMB_PROC();

            mod.C_STLGRD   = txtstlgrd.Value;
            mod.C_SPEC     = txtspec.Value;
            mod.C_STDCODE  = txtstdcode.Value;
            mod.C_DESC     = txtdesc.Value;
            mod.C_REMARK   = txtremark.Value;
            mod.C_PROCTYPE = dropproctype.SelectedItem.Text;

            if (!string.IsNullOrEmpty(hid.Value))
            {
                mod.C_ID = hid.Value;
                if (!string.IsNullOrEmpty(filename))
                {
                    mod.C_IMGURL = path + newfilename;
                    string savepath = System.Web.HttpContext.Current.Server.MapPath(path) + newfilename;
                    File1.PostedFile.SaveAs(savepath);
                }
                else
                {
                    mod.C_IMGURL = hidimg.Value;
                }
                if (tmb_proc.UpdateProc(mod))
                {
                    Response.Write("<script>alert('修改成功');window.parent.getProcList();window.parent.close();</script>");
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(filename))
                {
                    mod.C_IMGURL = path + newfilename;
                    string savepath = System.Web.HttpContext.Current.Server.MapPath(path) + newfilename;
                    File1.PostedFile.SaveAs(savepath);
                }
                if (tmb_proc.AddProc(mod))
                {
                    WebMsg.MessageBox("添加成功", "ProcAdd.aspx");
                }
            }
        }
Esempio n. 4
0
        public bool UpdateProc(Mod_TMB_PROC mod)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update  TMB_PROC SET C_STLGRD=:C_STLGRD,C_SPEC=:C_SPEC,C_STDCODE=:C_STDCODE,C_DESC=:C_DESC,C_REMARK=:C_REMARK,C_PROCTYPE=:C_PROCTYPE,C_IMGURL=:C_IMGURL  WHERE C_ID=:C_ID");

            OracleParameter[] parameters =
            {
                new OracleParameter(":C_STLGRD",   OracleDbType.Varchar2,   100),
                new OracleParameter(":C_SPEC",     OracleDbType.Varchar2,   500),
                new OracleParameter(":C_STDCODE",  OracleDbType.Varchar2,   100),
                new OracleParameter(":C_DESC",     OracleDbType.Varchar2,   200),
                new OracleParameter(":C_REMARK",   OracleDbType.Varchar2,   500),
                new OracleParameter(":C_PROCTYPE", OracleDbType.NVarchar2, 1000),
                new OracleParameter(":C_IMGURL",   OracleDbType.Varchar2,   200),
                new OracleParameter(":C_ID",       OracleDbType.Varchar2, 100)
            };
            parameters[0].Value = mod.C_STLGRD;
            parameters[1].Value = mod.C_SPEC;
            parameters[2].Value = mod.C_STDCODE;
            parameters[3].Value = mod.C_DESC;
            parameters[4].Value = mod.C_REMARK;
            parameters[5].Value = mod.C_PROCTYPE;
            parameters[6].Value = mod.C_IMGURL;
            parameters[7].Value = mod.C_ID;
            int rows = DbHelperOra.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 5
0
 /// <summary>
 /// 更新产品
 /// </summary>
 /// <param name="mod">产品属性</param>
 /// <returns></returns>
 public bool UpdateProc(Mod_TMB_PROC mod)
 {
     return(dal.UpdateProc(mod));
 }
Esempio n. 6
0
 /// <summary>
 /// 添加产品
 /// </summary>
 /// <param name="mod">产品属性</param>
 /// <returns></returns>
 public bool AddProc(Mod_TMB_PROC mod)
 {
     return(dal.AddProc(mod));
 }