///// <summary>
        ///// 保存
        ///// </summary>
        ///// <param name="sender"></param>
        ///// <param name="e"></param>
        //protected void btnAdd_Click(object sender, EventArgs e)
        //{
        //    //Response.Redirect("ArchiveCellReportAdd.aspx?Action=add&ID=0&recid="+ID+"&sqlwhere = " + SqlWhere + "");
        //    //List<string> sellist = ctrlGridEx1.GetSelects();
        //    //if (sellist.Count > 0)
        //    //{
        //        //T_SingleProject_MDL model = (new T_SingleProject_BLL()).GetModel(ConvertEx.ToInt(sellist[0].ToString()));

        //    //}
        //}
        private void SaveSelect()
        {
            //try
            //{
            string SelectIDList = Common.Session.GetSession("SelectIDList");

            if (!String.IsNullOrEmpty(SelectIDList))
            {
                //List<string> SelectList = (List<string>)Session["SelectList"];
                BLL.T_CellTmp_BLL bll1 = new DigiPower.Onlinecol.Standard.BLL.T_CellTmp_BLL();
                BLL.T_FileListTmp_CellRptTmp_BLL bll2 = new DigiPower.Onlinecol.Standard.BLL.T_FileListTmp_CellRptTmp_BLL();
                foreach (string CellReportID in SelectIDList.Split(','))
                {
                    if (CellReportID != "" && !bll2.Exists("recID=" + ID + " AND CellFilePath='" + CellReportID + "'"))
                    {
                        Model.T_CellTmp_MDL mdl = bll1.GetModel(Common.ConvertEx.ToInt(CellReportID));
                        if (mdl != null)
                        {
                            Model.T_FileListTmp_CellRptTmp_MDL mdl2 = new DigiPower.Onlinecol.Standard.Model.T_FileListTmp_CellRptTmp_MDL();
                            mdl2.CellFilePath = CellReportID;
                            mdl2.recID        = Common.ConvertEx.ToInt(ID);
                            mdl2.Title        = mdl.Title;
                            mdl2.OrderIndex   = Common.ConvertEx.ToInt(mdl.OrderIndex);
                            bll2.Add(mdl2);
                        }
                    }
                }
                Session["SelectIDList"] = null;
            }
            //}
            //catch { Session["SelectIDList"] = null; }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(DigiPower.Onlinecol.Standard.Model.T_FileListTmp_CellRptTmp_MDL model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update T_FileListTmp_CellRptTmp set ");
            strSql.Append("recID=@recID,");
            strSql.Append("Title=@Title,");
            strSql.Append("CellFilePath=@CellFilePath,");
            strSql.Append("OrderIndex=@OrderIndex");
            strSql.Append(" where CellReportID=@CellReportID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CellReportID", SqlDbType.Int,        8),
                new SqlParameter("@recID",        SqlDbType.Int,        8),
                new SqlParameter("@Title",        SqlDbType.NVarChar, 200),
                new SqlParameter("@CellFilePath", SqlDbType.NVarChar, 250),
                new SqlParameter("@OrderIndex",   SqlDbType.Int, 8)
            };
            parameters[0].Value = model.CellReportID;
            parameters[1].Value = model.recID;
            parameters[2].Value = model.Title;
            parameters[3].Value = model.CellFilePath;
            parameters[4].Value = model.OrderIndex;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(DigiPower.Onlinecol.Standard.Model.T_FileListTmp_CellRptTmp_MDL model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into T_FileListTmp_CellRptTmp(");
            strSql.Append("recID,Title,CellFilePath,OrderIndex)");
            strSql.Append(" values (");
            strSql.Append("@recID,@Title,@CellFilePath,@OrderIndex)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@recID",        SqlDbType.Int,        8),
                new SqlParameter("@Title",        SqlDbType.NVarChar, 200),
                new SqlParameter("@CellFilePath", SqlDbType.NVarChar, 250),
                new SqlParameter("@OrderIndex",   SqlDbType.Int, 8)
            };
            parameters[0].Value = model.recID;
            parameters[1].Value = model.Title;
            parameters[2].Value = model.CellFilePath;
            parameters[3].Value = model.OrderIndex;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
예제 #4
0
 /// <summary>
 /// 绑定页面
 /// </summary>
 /// <param name="ID"></param>
 private void BindPage(string ID)
 {
     Model.T_FileListTmp_CellRptTmp_MDL model = new DigiPower.Onlinecol.Standard.Model.T_FileListTmp_CellRptTmp_MDL();
     BLL.T_FileListTmp_CellRptTmp_BLL   bll   = new DigiPower.Onlinecol.Standard.BLL.T_FileListTmp_CellRptTmp_BLL();
     model = bll.GetModel(Convert.ToInt32(ID));
     if (model != null)
     {
         DigiPower.Onlinecol.Standard.Web.Comm.SetValueToPage(model, this.tbl);
     }
 }
예제 #5
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Model.T_FileListTmp_CellRptTmp_MDL model = new DigiPower.Onlinecol.Standard.Model.T_FileListTmp_CellRptTmp_MDL();
            BLL.T_FileListTmp_CellRptTmp_BLL   bll   = new DigiPower.Onlinecol.Standard.BLL.T_FileListTmp_CellRptTmp_BLL();

            if (Convert.ToInt32(ID) != 0)
            {
                model = bll.GetModel(Convert.ToInt32(ID));
            }
            model = (Model.T_FileListTmp_CellRptTmp_MDL)Comm.GetValueToObject(model, this.tbl);
            if (Convert.ToInt32(ID) == 0)
            {
                ID = bll.Add(model).ToString();
            }
            else
            {
                bll.Update(model);
            }

            Response.Redirect("ArchiveCellReportList.aspx?sqlwhere=" + SqlWhere + "&PageIndex=" + pPageIndex + "&ID=" + Common.DNTRequest.GetString("recid"));
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public DigiPower.Onlinecol.Standard.Model.T_FileListTmp_CellRptTmp_MDL GetModel(int CellReportID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 CellReportID,recID,Title,CellFilePath,OrderIndex from T_FileListTmp_CellRptTmp ");
            strSql.Append(" where CellReportID=@CellReportID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CellReportID", SqlDbType.Int, 8)
            };
            parameters[0].Value = CellReportID;

            DigiPower.Onlinecol.Standard.Model.T_FileListTmp_CellRptTmp_MDL model = new DigiPower.Onlinecol.Standard.Model.T_FileListTmp_CellRptTmp_MDL();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["CellReportID"].ToString() != "")
                {
                    model.CellReportID = int.Parse(ds.Tables[0].Rows[0]["CellReportID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["recID"].ToString() != "")
                {
                    model.recID = int.Parse(ds.Tables[0].Rows[0]["recID"].ToString());
                }
                model.Title        = ds.Tables[0].Rows[0]["Title"].ToString();
                model.CellFilePath = ds.Tables[0].Rows[0]["CellFilePath"].ToString();
                if (ds.Tables[0].Rows[0]["OrderIndex"].ToString() != "")
                {
                    model.OrderIndex = int.Parse(ds.Tables[0].Rows[0]["OrderIndex"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }