Пример #1
0
        protected void btnDel_Click(object sender, EventArgs e)
        {
            if (grid1.SelectedRowIndexArray != null && grid1.SelectedRowIndexArray.Length > 0)
            {
                string strSelectID = "0";
                for (int i = 0, count = grid1.SelectedRowIndexArray.Length; i < count; i++)
                {
                    int rowIndex = grid1.SelectedRowIndexArray[i];
                    foreach (object key in grid1.DataKeys[rowIndex])
                    {
                        strSelectID = key.ToString();
                    }
                }
                #region  除逻辑

                zlzw.BLL.StoreStatisticsListBLL     storeStatisticsListBLL   = new zlzw.BLL.StoreStatisticsListBLL();
                zlzw.Model.StoreStatisticsListModal storeStatisticsListModal = storeStatisticsListBLL.GetModel(int.Parse(Get_StoreStatisticsID(strSelectID)));
                storeStatisticsListModal.IsEnable = 0;
                storeStatisticsListBLL.Update(storeStatisticsListModal);
                StoreStatisticsList_BindGrid();

                #endregion
            }
            else
            {
                return;
            }
        }
Пример #2
0
        protected void btnSaveRefresh_Click(object sender, EventArgs e)
        {
            if (Request.QueryString["Type"] == "1")
            {
                //编辑保存
                zlzw.Model.StoreStatisticsListModal storeStatisticsListModal = new zlzw.Model.StoreStatisticsListModal();
                storeStatisticsListModal.StoreDictionaryKey = drpStoreDictionaryKey.SelectedValue;
                storeStatisticsListModal.DictionaryKey      = drpDictionaryKey.SelectedValue;
                if (txbStoreStatisticsDate.Text == "")
                {
                    storeStatisticsListModal.StoreStatisticsDate = DateTime.Parse(ViewState["StoreStatisticsDate"].ToString());
                }
                else
                {
                    storeStatisticsListModal.StoreStatisticsDate = DateTime.Parse(txbStoreStatisticsDate.Text.ToString());
                }

                storeStatisticsListModal.IndexValue           = txbIndexValue.Text;
                storeStatisticsListModal.StoreStatisticsOrder = int.Parse(txbStoreStatisticsOrder.Text);
                storeStatisticsListModal.IsEnable             = 1;
                storeStatisticsListModal.PublishDate          = DateTime.Parse(ViewState["PublishDate"].ToString());
                storeStatisticsListModal.StoreStatisticsGUID  = new Guid(ViewState["StoreStatisticsGUID"].ToString());
                storeStatisticsListModal.StoreStatisticsID    = int.Parse(Get_StoreStatisticsID(Request.QueryString["value"]));
                zlzw.BLL.StoreStatisticsListBLL storeStatisticsListBLL = new zlzw.BLL.StoreStatisticsListBLL();
                storeStatisticsListBLL.Update(storeStatisticsListModal);
            }
            else
            {
                //添加保存

                zlzw.Model.StoreStatisticsListModal storeStatisticsListModal = new zlzw.Model.StoreStatisticsListModal();
                storeStatisticsListModal.StoreDictionaryKey   = drpStoreDictionaryKey.SelectedValue;
                storeStatisticsListModal.DictionaryKey        = drpDictionaryKey.SelectedValue;
                storeStatisticsListModal.StoreStatisticsDate  = DateTime.Parse(txbStoreStatisticsDate.Text.ToString());
                storeStatisticsListModal.IndexValue           = txbIndexValue.Text;
                storeStatisticsListModal.StoreStatisticsOrder = int.Parse(txbStoreStatisticsOrder.Text);
                storeStatisticsListModal.IsEnable             = 1;
                storeStatisticsListModal.PublishDate          = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"));
                storeStatisticsListModal.StoreStatisticsGUID  = System.Guid.NewGuid();
                zlzw.BLL.StoreStatisticsListBLL storeStatisticsListBLL = new zlzw.BLL.StoreStatisticsListBLL();
                storeStatisticsListBLL.Add(storeStatisticsListModal);
            }

            // 2. Close this window and Refresh parent window
            PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
        }
Пример #3
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public bool Update(zlzw.Model.StoreStatisticsListModal model)
        {
            int rowsAffected = 0;

            SqlParameter[] parameters =
            {
                new SqlParameter("@StoreStatisticsID",    SqlDbType.Int,               4),
                new SqlParameter("@StoreStatisticsGUID",  SqlDbType.UniqueIdentifier, 16),
                new SqlParameter("@StoreStatisticsDate",  SqlDbType.DateTime),
                new SqlParameter("@StoreDictionaryKey",   SqlDbType.NVarChar,         50),
                new SqlParameter("@DictionaryKey",        SqlDbType.NVarChar,         50),
                new SqlParameter("@IndexValue",           SqlDbType.NVarChar,         20),
                new SqlParameter("@IndexDesc",            SqlDbType.NVarChar),
                new SqlParameter("@StoreStatisticsOrder", SqlDbType.Int,               4),
                new SqlParameter("@IsEnable",             SqlDbType.Int,               4),
                new SqlParameter("@PublishDate",          SqlDbType.DateTime),
                new SqlParameter("@Other01",              SqlDbType.NVarChar,         50),
                new SqlParameter("@Other02",              SqlDbType.NVarChar,         50),
                new SqlParameter("@Other03",              SqlDbType.NVarChar,         50),
                new SqlParameter("@Other04",              SqlDbType.NVarChar)
            };
            parameters[0].Value  = model.StoreStatisticsID;
            parameters[1].Value  = model.StoreStatisticsGUID;
            parameters[2].Value  = model.StoreStatisticsDate;
            parameters[3].Value  = model.StoreDictionaryKey;
            parameters[4].Value  = model.DictionaryKey;
            parameters[5].Value  = model.IndexValue;
            parameters[6].Value  = model.IndexDesc;
            parameters[7].Value  = model.StoreStatisticsOrder;
            parameters[8].Value  = model.IsEnable;
            parameters[9].Value  = model.PublishDate;
            parameters[10].Value = model.Other01;
            parameters[11].Value = model.Other02;
            parameters[12].Value = model.Other03;
            parameters[13].Value = model.Other04;

            DbHelperSQL.RunProcedure("StoreStatisticsList_Update", parameters, out rowsAffected);
            if (rowsAffected > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #4
0
        private void LoadData(string strType)
        {
            if (strType == "1")
            {
                string strID = Request.QueryString["value"];//操作ID
                zlzw.BLL.StoreStatisticsListBLL     storeStatisticsListBLL   = new zlzw.BLL.StoreStatisticsListBLL();
                zlzw.Model.StoreStatisticsListModal storeStatisticsListModal = storeStatisticsListBLL.GetModel(int.Parse(Get_StoreStatisticsID(strID)));
                drpStoreDictionaryKey.SelectedValue = storeStatisticsListModal.StoreDictionaryKey;             //所属店铺
                drpDictionaryKey.SelectedValue      = storeStatisticsListModal.DictionaryKey;                  //所属指标
                txbStoreStatisticsDate.Text         = storeStatisticsListModal.StoreStatisticsDate.ToString(); //评比日期
                txbIndexValue.Text           = storeStatisticsListModal.IndexValue;                            //指标数值
                txbStoreStatisticsOrder.Text = storeStatisticsListModal.StoreStatisticsOrder.ToString();       //排序序号

                ViewState["StoreStatisticsDate"] = storeStatisticsListModal.StoreStatisticsDate.ToString();
                ViewState["PublishDate"]         = storeStatisticsListModal.PublishDate.ToString();
                ViewState["StoreStatisticsGUID"] = storeStatisticsListModal.StoreStatisticsGUID.ToString();
                ToolbarText2.Text = "编辑一个指标评比";
            }
            btnClose.OnClientClick = ActiveWindow.GetConfirmHideReference();
        }
Пример #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public zlzw.Model.StoreStatisticsListModal GetModel(int StoreStatisticsID)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@StoreStatisticsID", SqlDbType.Int, 4)
            };
            parameters[0].Value = StoreStatisticsID;

            zlzw.Model.StoreStatisticsListModal model = new zlzw.Model.StoreStatisticsListModal();
            DataSet ds = DbHelperSQL.RunProcedure("StoreStatisticsList_GetModel", parameters, "ds");

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Пример #6
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Add(zlzw.Model.StoreStatisticsListModal model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@StoreStatisticsID",    SqlDbType.Int,               4),
                new SqlParameter("@StoreStatisticsGUID",  SqlDbType.UniqueIdentifier, 16),
                new SqlParameter("@StoreStatisticsDate",  SqlDbType.DateTime),
                new SqlParameter("@StoreDictionaryKey",   SqlDbType.NVarChar,         50),
                new SqlParameter("@DictionaryKey",        SqlDbType.NVarChar,         50),
                new SqlParameter("@IndexValue",           SqlDbType.NVarChar,         20),
                new SqlParameter("@IndexDesc",            SqlDbType.NVarChar),
                new SqlParameter("@StoreStatisticsOrder", SqlDbType.Int,               4),
                new SqlParameter("@IsEnable",             SqlDbType.Int,               4),
                new SqlParameter("@PublishDate",          SqlDbType.DateTime),
                new SqlParameter("@Other01",              SqlDbType.NVarChar,         50),
                new SqlParameter("@Other02",              SqlDbType.NVarChar,         50),
                new SqlParameter("@Other03",              SqlDbType.NVarChar,         50),
                new SqlParameter("@Other04",              SqlDbType.NVarChar)
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = Guid.NewGuid();
            parameters[2].Value     = model.StoreStatisticsDate;
            parameters[3].Value     = model.StoreDictionaryKey;
            parameters[4].Value     = model.DictionaryKey;
            parameters[5].Value     = model.IndexValue;
            parameters[6].Value     = model.IndexDesc;
            parameters[7].Value     = model.StoreStatisticsOrder;
            parameters[8].Value     = model.IsEnable;
            parameters[9].Value     = model.PublishDate;
            parameters[10].Value    = model.Other01;
            parameters[11].Value    = model.Other02;
            parameters[12].Value    = model.Other03;
            parameters[13].Value    = model.Other04;

            DbHelperSQL.RunProcedure("StoreStatisticsList_ADD", parameters, out rowsAffected);
            return((int)parameters[0].Value);
        }
Пример #7
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public zlzw.Model.StoreStatisticsListModal DataRowToModel(DataRow row)
 {
     zlzw.Model.StoreStatisticsListModal model = new zlzw.Model.StoreStatisticsListModal();
     if (row != null)
     {
         if (row["StoreStatisticsID"] != null && row["StoreStatisticsID"].ToString() != "")
         {
             model.StoreStatisticsID = int.Parse(row["StoreStatisticsID"].ToString());
         }
         if (row["StoreStatisticsGUID"] != null && row["StoreStatisticsGUID"].ToString() != "")
         {
             model.StoreStatisticsGUID = new Guid(row["StoreStatisticsGUID"].ToString());
         }
         if (row["StoreStatisticsDate"] != null && row["StoreStatisticsDate"].ToString() != "")
         {
             model.StoreStatisticsDate = DateTime.Parse(row["StoreStatisticsDate"].ToString());
         }
         if (row["StoreDictionaryKey"] != null)
         {
             model.StoreDictionaryKey = row["StoreDictionaryKey"].ToString();
         }
         if (row["DictionaryKey"] != null)
         {
             model.DictionaryKey = row["DictionaryKey"].ToString();
         }
         if (row["IndexValue"] != null)
         {
             model.IndexValue = row["IndexValue"].ToString();
         }
         if (row["IndexDesc"] != null)
         {
             model.IndexDesc = row["IndexDesc"].ToString();
         }
         if (row["StoreStatisticsOrder"] != null && row["StoreStatisticsOrder"].ToString() != "")
         {
             model.StoreStatisticsOrder = int.Parse(row["StoreStatisticsOrder"].ToString());
         }
         if (row["IsEnable"] != null && row["IsEnable"].ToString() != "")
         {
             model.IsEnable = int.Parse(row["IsEnable"].ToString());
         }
         if (row["PublishDate"] != null && row["PublishDate"].ToString() != "")
         {
             model.PublishDate = DateTime.Parse(row["PublishDate"].ToString());
         }
         if (row["Other01"] != null)
         {
             model.Other01 = row["Other01"].ToString();
         }
         if (row["Other02"] != null)
         {
             model.Other02 = row["Other02"].ToString();
         }
         if (row["Other03"] != null)
         {
             model.Other03 = row["Other03"].ToString();
         }
         if (row["Other04"] != null)
         {
             model.Other04 = row["Other04"].ToString();
         }
     }
     return(model);
 }