Exemple #1
0
        private void bindList()
        {
            SearchDownLoad con = new SearchDownLoad();

            con.CpDLName = txtCpInforTypeName.Text.Trim().ToString();
            if (rbtnIsChinese.Checked == true)
            {
                con.IsEnglish = 1;
            }
            else if (rbtnIsEnglish.Checked == true)
            {
                con.IsEnglish = 2;
            }
            Pagination pagina = new Pagination(pager.PageIndex, pager.PageSize, 0);

            using (BLLDownLoad bll = new BLLDownLoad())
            {
                List <DownLoad> lists = bll.GetPageList(con, pagina, DownLoad.ID_FieldName, ScriptQuery.SortEnum.DESC);

                pager.RecordCount = pagina.RecordCount;
                pager.PageCount   = pagina.PageCount;

                grid_friendlink.DataSource = lists;
                grid_friendlink.DataBind();
            }
        }
Exemple #2
0
        private void setnews()
        {
            SearchDownLoad snt = new SearchDownLoad();

            snt.IsEnglish = 1;
            if (type == "")
            {
            }
            else
            {
                snt.CpDLName = type;
            }
            Pagination pagination = new DevNet.Common.Pagination(pager.PageIndex, pager.PageSize, 0);

            using (BLLDownLoad bll = new BLLDownLoad())
            {
                List <DownLoad> lists = bll.GetPageList(snt, pagination);
                pager.RecordCount  = pagination.RecordCount;
                rptNews.DataSource = lists;
                rptNews.DataBind();
            }
        }
Exemple #3
0
        public static string OperateRecords(string ids, int op)
        {
            string[] array = ids.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            using (BLLDownLoad bll = new BLLDownLoad())
            {
                foreach (string id in array)
                {
                    switch (op)
                    {
                    case 7:
                        bll.Delete(id);
                        break;
                    }
                }

                if (bll.IsFail)
                {
                    return(ExceptionManager.GetErrorMsg(bll.DevNetException));
                }
            }
            return(string.Empty);
        }
 private void setInfo()
 {
     if (id > 0)
     {
         using (BLLDownLoad bll = new BLLDownLoad())
         {
             DownLoad dwinfor = bll.GetSingle(id);
             if (dwinfor != null)
             {
                 if (dwinfor.IsEnglish == 1)
                 {
                     rbtnIsChinese.Checked = true;
                 }
                 else if (dwinfor.IsEnglish == 2)
                 {
                     rbtnIsEnglish.Checked = true;
                 }
                 txtDLName.Text    = dwinfor.DLName;
                 txtRemarks.Text   = dwinfor.Remarks;
                 lblDLAddress.Text = dwinfor.DLAddress;
             }
         }
     }
 }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            using (BLLDownLoad bll = new BLLDownLoad())
            {
                DownLoad obj = new DownLoad();

                if (id > 0)
                {
                    obj    = bll.GetSingle(id);
                    obj.ID = id;
                }
                obj.DLName    = txtDLName.Text.Trim().ToString();
                obj.DLAddTime = Convert.ToDateTime(DateTime.Now.ToShortDateString());
                obj.Remarks   = txtRemarks.Text.ToString();
                if (Session["admin"] != null)
                {
                    AdminUser adminuser = GetAdminUser();
                    if (adminuser != null)
                    {
                        obj.DLAddName = adminuser.TrueName.ToString();
                    }
                }

                if (rbtnIsChinese.Checked == true)
                {
                    obj.IsEnglish = 1;
                }
                else if (rbtnIsEnglish.Checked == true)
                {
                    obj.IsEnglish = 2;
                }
                else
                {
                    ShowMsg("请选择语言类别!");
                    return;
                }


                #region   产品图片(前台产品图片来源于此)
                try
                {
                    if (this.UploadDLAddress.HasFile)
                    {
                        string extName = Path.GetExtension(UploadDLAddress.FileName);
                        string virFileFullName;
                        string fileName;
                        WebCommon.GetUploadRandFileName(extName, out virFileFullName, out fileName);
                        if (UploadDLAddress.PostedFile.ContentLength < 5000000)//文件小于5M
                        {
                            UploadDLAddress.SaveAs(StringPlus.MapPath(virFileFullName));
                        }
                        else
                        {
                            ShowMsg("文件大小不能超过5M!");
                            return;
                        }
                        if (IsAllowedExtension(StringPlus.MapPath(virFileFullName)))
                        {
                            if (id > 0)
                            {//新增时无需删除
                                if (File.Exists(StringPlus.MapPath(bll.GetSingle(id).DLAddress)))
                                {
                                    File.Delete(StringPlus.MapPath(bll.GetSingle(id).DLAddress));
                                }
                            }
                            obj.DLAddress = virFileFullName;
                        }
                        else
                        {
                            if (File.Exists(StringPlus.MapPath(virFileFullName)))
                            {
                                File.Delete(StringPlus.MapPath(virFileFullName));
                            }
                            ShowMsg("此文件类型不可以上传");
                            return;
                        }
                    }
                    else
                    {
                        obj.DLAddress = lblDLAddress.Text;
                    }
                }
                catch (DevNetException ex)
                {
                    ExceptionManager.ShowErrorMsg(this, ex);
                    return;
                }
                #endregion

                bll.Save(obj);

                if (bll.IsFail)
                {
                    ExceptionManager.ShowErrorMsg(this, bll.DevNetException);
                }
                else
                {
                    JSMsg.ShowWinRedirect(this, "保存成功", "cpDownLoadList.aspx");
                }
            }
        }