Example #1
0
        //插入数据
        private void insertData(string inserTableName, List <dataModel> llist)
        {
            string        CONTROLID = DbHelperOra.GetMaxID("CONTROLID", inserTableName).ToString();
            StringBuilder insertSb  = new StringBuilder();
            List <string> fieldlist = new List <string>();
            List <string> valuelist = new List <string>();

            fieldlist.Add("CONTROLID");
            valuelist.Add(string.Format("'{0}'", CONTROLID));
            foreach (dataModel item in llist)
            {
                fieldlist.Add(item.field);
                valuelist.Add(string.Format("'{0}'", item.value));
            }
            insertSb.AppendFormat("insert into {0} ({1}) values ({2})", inserTableName, string.Join(",", fieldlist), string.Join(",", valuelist));
            try
            {
                int rows = DbHelperOra.ExecuteSql(insertSb.ToString());
                result = "保存成功";
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }
        }
Example #2
0
 /// <summary>
 /// 得到最大编号
 /// </summary>
 /// <returns></returns>
 public int GetMaxId()
 {
     return(DbHelperOra.GetMaxID("NodeID", "S_Tree"));
 }
Example #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool AddByModelList(List <EDRS.Model.YX_DZJZ_JZRZJL> modelList)
        {
            int xh = 0;

            //获取序号
            try
            {
                xh = DbHelperOra.GetMaxID("XH", "YX_DZJZ_JZRZJL");
            }
            catch (Exception ex)
            {
                EDRS.Common.LogHelper.LogError(this.context, "Exception", ex.Message, "public bool Add(EDRS.Model.YX_DZJZ_JZRZJL model)|DbHelperOra.GetMaxID(\"XH\", \"YX_DZJZ_JZRZJL\")", "EDRS.OracleDAL.YX_DZJZ_JZRZJL");
                return(false);
            }


            int       count = 0;
            Hashtable hash  = new Hashtable();

            foreach (EDRS.Model.YX_DZJZ_JZRZJL model in modelList)
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into YX_DZJZ_JZRZJL(");
                strSql.Append("XH,DWBM,DWMC,BMBM,BMMC,CZRGH,CZR,CZSJ,CZIP,CZLX,RZNR,CZAJBMSAH,FQL)");
                strSql.Append(" values (");
                strSql.Append(":XH" + count + ",:DWBM" + count + ",:DWMC" + count + ",:BMBM" + count + ",:BMMC" + count + ",:CZRGH" + count + ",:CZR" + count + ",:CZSJ" + count + ",:CZIP" + count + ",:CZLX" + count + ",:RZNR" + count + ",:CZAJBMSAH" + count + ",:FQL" + count + ")");
                OracleParameter[] parameters =
                {
                    new OracleParameter(":XH" + count,        OracleType.Number,      4),
                    new OracleParameter(":DWBM" + count,      OracleType.VarChar,    50),
                    new OracleParameter(":DWMC" + count,      OracleType.VarChar,   300),
                    new OracleParameter(":BMBM" + count,      OracleType.Char,       10),
                    new OracleParameter(":BMMC" + count,      OracleType.VarChar,   300),
                    new OracleParameter(":CZRGH" + count,     OracleType.Char,        4),
                    new OracleParameter(":CZR" + count,       OracleType.VarChar,    60),
                    new OracleParameter(":CZSJ" + count,      OracleType.DateTime),
                    new OracleParameter(":CZIP" + count,      OracleType.VarChar,    20),
                    new OracleParameter(":CZLX" + count,      OracleType.Char,        2),
                    new OracleParameter(":RZNR" + count,      OracleType.VarChar,   300),
                    new OracleParameter(":CZAJBMSAH" + count, OracleType.VarChar,   100),
                    new OracleParameter(":FQL" + count,       OracleType.Char, 4)
                };
                parameters[0].Value  = xh++;
                parameters[1].Value  = model.DWBM;
                parameters[2].Value  = model.DWMC;
                parameters[3].Value  = model.BMBM;
                parameters[4].Value  = model.BMMC;
                parameters[5].Value  = model.CZRGH;
                parameters[6].Value  = model.CZR;
                parameters[7].Value  = model.CZSJ;
                parameters[8].Value  = model.CZIP;
                parameters[9].Value  = model.CZLX;
                parameters[10].Value = model.RZNR;
                parameters[11].Value = model.CZAJBMSAH;
                parameters[12].Value = DateTime.Now.Year;

                hash.Add(strSql.ToString(), parameters);
                count++;
            }

            try
            {
                return(DbHelperOra.ExecuteSqlTran(hash));
            }
            catch (Exception ex)
            {
                EDRS.Common.LogHelper.LogError(this.context, "Exception", ex.Message, "public bool Add(EDRS.Model.YX_DZJZ_JZRZJL model)", "EDRS.OracleDAL.YX_DZJZ_JZRZJL", hash);
            }
            return(false);
        }
Example #4
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string type     = context.Request.QueryString["type"];
            string Data     = context.Request.Form["data"];
            string layoutid = context.Request.QueryString["layoutid"];

            FORM_BUILDER_FORM frmBll = new FORM_BUILDER_FORM();

            GYLYEQ.Model.FORM_BUILDER_FORM frmModel = new GYLYEQ.Model.FORM_BUILDER_FORM();

            FORM_BUILDER_CONTROL cntrBll = new FORM_BUILDER_CONTROL();

            GYLYEQ.Model.FORM_BUILDER_CONTROL cntrModel = new GYLYEQ.Model.FORM_BUILDER_CONTROL();

            switch (type)
            {
            case "savelayout":
                string formName = context.Request.QueryString["formName"];
                savelayout(Data, formName);         //创建自定义表单模板数据及动态表
                break;

            case "savepostdata":
                savepostdata(Data, layoutid);       //插入自定义表单用户数据
                break;

            case "showData":
                string pageindex = context.Request.QueryString["page"];
                string pagesize  = context.Request.QueryString["limit"];
                string wheres    = context.Request.Params["wheres"];
                GetJsonData(pageindex, pagesize, wheres, layoutid);
                break;

            case "save":

                var                mRequest  = HttpContext.Current.Request.Form["data"];
                string             formTitle = HttpContext.Current.Server.UrlDecode(HttpContext.Current.Request.QueryString["formTitle"]);
                string             columns   = HttpContext.Current.Request.QueryString["columns"];
                string             tabName   = string.Format("FORM_BUILDER_{0}", DateTime.Now.ToString("yyyyMMddHHmmss"));
                List <formControl> clist     = JsonConvert.DeserializeObject <List <formControl> >(mRequest);
                frmModel.FORMID         = DbHelperOra.GetMaxID("FORMID", "FORM_BUILDER_FORM");
                frmModel.FORMNAME       = formTitle;
                frmModel.FORMCREATETIME = DateTime.Now;
                frmModel.FORMCOLUMNS    = int.Parse(columns);
                frmModel.FORMREMARK     = formTitle;
                frmModel.FORMTABLE      = tabName;
                frmBll.Add(frmModel);

                foreach (formControl item in clist)
                {
                    cntrModel.CONTROLID      = DbHelperOra.GetMaxID("CONTROLID", "FORM_BUILDER_CONTROL");
                    cntrModel.CONTROLNAME    = item.name;
                    cntrModel.CONTROLSORT    = item.sort.ToString();
                    cntrModel.CONTROLREQUIRE = item.required;
                    cntrModel.CONTROLREMARK  = item.remark;
                    cntrModel.CONTROLHTML    = item.html;
                    cntrModel.FORMID         = frmModel.FORMID;
                    cntrModel.CONTROLFIELD   = item.field;
                    cntrBll.Add(cntrModel);
                }
                //创建对应的业务表
                CreateTable(clist, tabName);

                break;

            case "savedata":
                var data = HttpContext.Current.Request.Form["data"];
                List <dataModel> llist          = JsonConvert.DeserializeObject <List <dataModel> >(data);
                string           formID         = HttpContext.Current.Request.QueryString["formID"];
                string           inserTableName = frmBll.GetModel(decimal.Parse(formID)).FORMTABLE;
                insertData(inserTableName, llist);

                //进行数据插入
                break;

            case "upload":
                UpLoadFile(context);
                break;

            default:
                break;
            }
            context.Response.Write(result);
        }