Exemplo n.º 1
0
        private void GeneralADList_BindGrid()
        {
            zlzw.BLL.GeneralADBLL generalADBLL = new zlzw.BLL.GeneralADBLL();
            DataTable dt = generalADBLL.GetList(grid1.PageSize, grid1.PageIndex + 1, "*", "UpdateDate", 0, "desc", "CanUsable=1").Tables[0];

            grid1.DataSource = dt;
            grid1.DataBind();
        }
Exemplo n.º 2
0
 /// <summary>
 /// 获取总页数
 /// </summary>
 /// <returns></returns>
 private int Get_GeneralADListTotalCount()
 {
     zlzw.BLL.GeneralADBLL generalADBLL = new zlzw.BLL.GeneralADBLL();
     DataTable dt = generalADBLL.GetList("CanUsable=1").Tables[0];
     if (dt.Rows.Count > 0)
     {
         return dt.Rows.Count;
     }
     else
     {
         return 0;
     }
 }
Exemplo n.º 3
0
 private void LoadData(string strType)
 {
     if (strType == "1")
     {
         string strID = Request.QueryString["value"];//操作ID
         zlzw.BLL.GeneralADBLL generalADBLL = new zlzw.BLL.GeneralADBLL();
         zlzw.Model.GeneralADModel generalADModel = generalADBLL.GetModel(int.Parse(Get_ID(generalADBLL, strID)));
         txbADName.Text = generalADModel.ADName;//广告名称
         //drpADType.SelectedValue = generalADModel.ADType.ToString();//广告类型
         //txbADScript.Text = generalADModel.ADScript;//广告脚本
         //txbADTargetUrl.Text = generalADModel.ADTargetUrl;//跳转地址
         txbOrderNumber.Text = generalADModel.ADOrderNumber.ToString();//排序字段
         //if (generalADModel.ADStatus == 1)
         //{
         //    ckbADStatus.Checked = true;
         //}
         //else
         //{
         //    ckbADStatus.Checked = false;
         //}
         dateStartTime.Text = generalADModel.DisplayStartDate.ToString();//开始日期
         dateEndTime.Text = generalADModel.DisplayEndDate.ToString();//结束日期
         drpEnterpriseType.SelectedValue = generalADModel.EnterpriseGuid.ToString();//所属企业ID
         txbADDesc.Text = generalADModel.ADDesc;//广告简介
         ViewState["ADImagePath"] = generalADModel.ADImagePath;//广告图片路径
         ViewState["CreateDate"] = generalADModel.CreateDate.ToString();//创建日期
         ViewState["ADGuid"] = generalADModel.ADGuid.ToString();
         ToolbarText2.Text = "编辑一个广告";
     }
     btnClose.OnClientClick = ActiveWindow.GetConfirmHideReference();
 }
Exemplo n.º 4
0
        protected void btnSaveRefresh_Click(object sender, EventArgs e)
        {
            if (Request.QueryString["Type"] == "1")
            {
                //编辑保存
                zlzw.Model.GeneralADModel generalADModel = new zlzw.Model.GeneralADModel();
                generalADModel.ADName = txbADName.Text;//广告名称
                //generalADModel.ADType = int.Parse(drpADType.SelectedValue);//广告类型
                generalADModel.ADType = 1;//广告类型
                //generalADModel.ADScript = txbADScript.Text;//广告脚本
                //generalADModel.ADTargetUrl = txbADTargetUrl.Text;//跳转地址
                generalADModel.CreateDate = DateTime.Parse(ViewState["CreateDate"].ToString());
                generalADModel.UpdateDate = DateTime.Now;//更新日期
                generalADModel.ADOrderNumber = int.Parse(txbOrderNumber.Text);//排序字段
                generalADModel.ADStatus = 1;
                generalADModel.DisplayStartDate = DateTime.Parse(dateStartTime.Text);//开始日期
                generalADModel.DisplayEndDate = DateTime.Parse(dateEndTime.Text);//结束日期
                if (fileUploadImage.PostedFile.ContentLength > 0)
                {
                    fileUploadImage.SaveAs(Server.MapPath(ViewState["ADImagePath"].ToString()));
                    generalADModel.ADImagePath = ViewState["ADImagePath"].ToString();
                }
                else
                {
                    generalADModel.ADImagePath = ViewState["ADImagePath"].ToString();
                }
                generalADModel.EnterpriseGuid = new Guid(drpEnterpriseType.SelectedValue);//所属企业GUID
                generalADModel.CreateUserKey = Request.Cookies["UserID"].Value;//创建人GUID
                generalADModel.CreateUserName = Get_UserName();
                generalADModel.CanUsable = 1;
                generalADModel.ADDesc = txbADDesc.Text;//广告简介
                generalADModel.ADGuid = new Guid(ViewState["ADGuid"].ToString());
                zlzw.BLL.GeneralADBLL generalADBLL = new zlzw.BLL.GeneralADBLL();
                generalADModel.ADID = int.Parse(Get_ID(generalADBLL, Request.QueryString["value"]));

                generalADBLL.Update(generalADModel);
            }
            else
            {
                //添加保存
                zlzw.Model.GeneralADModel generalADModel = new zlzw.Model.GeneralADModel();
                generalADModel.ADName = txbADName.Text;//广告名称
                generalADModel.ADType = 1;//广告类型
                //generalADModel.ADScript = txbADScript.Text;//广告脚本
                //generalADModel.ADTargetUrl = txbADTargetUrl.Text;//跳转地址
                generalADModel.ADOrderNumber = int.Parse(txbOrderNumber.Text);//排序字段
                generalADModel.CreateDate = DateTime.Now;//创建日期
                generalADModel.UpdateDate = DateTime.Now;//更新日期
                generalADModel.ADStatus = 1;
                generalADModel.CanUsable = 1;
                generalADModel.DisplayStartDate = DateTime.Parse(dateStartTime.Text);//开始日期
                generalADModel.DisplayEndDate = DateTime.Parse(dateEndTime.Text);//结束日期
                if (fileUploadImage.PostedFile.ContentLength > 0)
                {
                    string fileName = DateTime.Now.Ticks.ToString() + "_" + fileUploadImage.FileName;
                    fileUploadImage.SaveAs(Server.MapPath("~/UploadImages/" + fileName));
                    generalADModel.ADImagePath = "~/UploadImages/" + fileName;//保存广告图片路径
                }
                generalADModel.EnterpriseGuid = new Guid(drpEnterpriseType.SelectedValue);//所属企业GUID
                generalADModel.CreateUserKey = Request.Cookies["UserID"].Value;//创建人GUID
                generalADModel.CreateUserName = Get_UserName();
                generalADModel.ADDesc = txbADDesc.Text;//广告简介
                zlzw.BLL.GeneralADBLL generalADBLL = new zlzw.BLL.GeneralADBLL();
                generalADBLL.Add(generalADModel);
            }

            // 2. Close this window and Refresh parent window
            PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
        }
Exemplo n.º 5
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.GeneralADBLL generalADBLL = new zlzw.BLL.GeneralADBLL();
                DataTable dt = generalADBLL.GetList("ADGuid='" + strSelectID + "'").Tables[0];
                zlzw.Model.GeneralADModel generalADModel = generalADBLL.GetModel(int.Parse(dt.Rows[0]["ADGuid"].ToString()));
                generalADModel.CanUsable = 0;
                generalADBLL.Update(generalADModel);
                GeneralADList_BindGrid();

                #endregion
            }
            else
            {
                return;
            }
        }
Exemplo n.º 6
0
        private void Load_GeneralADList()
        {
            zlzw.BLL.GeneralADBLL generalADBLL = new zlzw.BLL.GeneralADBLL();
            string strCurrent = DateTime.Now.ToString();//当前系统日期
            DataTable dt = generalADBLL.GetList(10, "CanUsable=1 and ADStatus=1 and DisplayStartDate<='" + strCurrent + "' and DisplayEndDate >='"+strCurrent+"'", "ADOrderNumber asc").Tables[0];

            Repeater2.DataSource = dt;
            Repeater2.DataBind();
        }