Esempio n. 1
0
 public void CreateDownload(Download download)
 {
     using (SqlConnection connection = base.GetConnection())
     {
         SqlCommand command = new SqlCommand("_DownloadUpdate", connection) {
             CommandType = CommandType.StoredProcedure
         };
         command.Parameters.AddWithValue("@Type", 0);
         command.Parameters.AddWithValue("@DownloadID", 0);
         command.Parameters.AddWithValue("@CateDownloadID", download.CateDownloadID);
         command.Parameters.AddWithValue("@Title", download.Title);
         command.Parameters.AddWithValue("@ShortDescribe", download.ShortDescribe);
         command.Parameters.AddWithValue("@FullDescribe", download.FullDescribe);
         command.Parameters.AddWithValue("@ImageThumb", download.ImageThumb);
         command.Parameters.AddWithValue("@FileName", download.FileName);
         command.Parameters.AddWithValue("@Author", download.Author);
         command.Parameters.AddWithValue("@PostDate", download.PostDate);
         command.Parameters.AddWithValue("@RelationTotal", download.RelationTotal);
         command.Parameters.AddWithValue("@Status", download.Status);
         command.Parameters.AddWithValue("@Language", download.Language);
         command.Parameters.AddWithValue("@Ishot", download.Ishot);
         command.Parameters.AddWithValue("@Isview", download.Isview);
         command.Parameters.AddWithValue("@Ishome", download.Ishome);
         command.Parameters.AddWithValue("@IsComment", download.IsComment);
         command.Parameters.AddWithValue("@ApprovalDate", download.ApprovalDate);
         command.Parameters.AddWithValue("@ApprovalUserName", download.ApprovalUserName);
         command.Parameters.AddWithValue("@IsApproval", download.IsApproval);
         command.Parameters.AddWithValue("@CreatedUserName", download.CreatedUserName);
         command.Parameters.AddWithValue("@CommentTotal", download.CommentTotal);
         connection.Open();
         if (command.ExecuteNonQuery() <= 0)
         {
             throw new DataAccessException("Kh\x00f4ng thể th\x00eam mới tin");
         }
         command.Dispose();
     }
 }
Esempio n. 2
0
 public void CreateDownload(Download download)
 {
     new DownloadDAO().CreateDownload(download);
 }
Esempio n. 3
0
 public void UpdateDownload(Download download)
 {
     new DownloadDAO().UpdateDownload(download);
 }
Esempio n. 4
0
        private void initControl(int Id)
        {
            AdminBSO adminBSO = new AdminBSO();
            ETO.Admin admin = new ETO.Admin();
            if (Id > 0)
            {
                btn_add.Visible = false;
                btn_edit.Visible = true;
                try
                {
                    Download download = new Download();
                    DownloadBSO downloadBSO = new DownloadBSO();
                    download = downloadBSO.GetDownloadById(Id);
                    hddDownloadID.Value = Convert.ToString(download.DownloadID);

                    ddlCateDownload.SelectedValue = Convert.ToString(download.CateDownloadID);
                    txtTitle.Text = download.Title;
                    txtRadShort.Html = download.ShortDescribe;
                    txtRadFull.Html = download.FullDescribe;
                    hddImageThumb.Value = download.ImageThumb;
                    hddFileName.Value = download.FileName;
                    txtAuthor.Text = download.Author;
                    txtRadDate.SelectedDate = download.PostDate;
                    hddRelationTotal.Value = Convert.ToString(download.RelationTotal);
                    rdbStatus.SelectedValue = Convert.ToString(download.Status);
                    rdbIshot.SelectedValue = Convert.ToString(download.Ishot);
                    rdbIshome.SelectedValue = Convert.ToString(download.Ishome);

                    hddCommentTotal.Value = Convert.ToString(download.CommentTotal);
                    hddIsView.Value = Convert.ToString(download.Isview);
                    hddCreateUserName.Value = download.CreatedUserName;
                    hddApprovalUserName.Value = download.ApprovalUserName;
                    hddApprovalDate.Value = Convert.ToString(download.ApprovalDate);

                    rdbComment.SelectedValue = Convert.ToString(download.IsComment);

                    admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());

                    if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval"))
                    {
                        rdbApproval.SelectedValue = Convert.ToString(download.IsApproval);
                        rdbApproval.Enabled = true;
                    }
                    else
                    {
                        rdbApproval.SelectedValue = Convert.ToString(download.IsApproval);
                        rdbApproval.Enabled = false;
                    }




                }
                catch (Exception ex)
                {
                    clientview.Text = ex.Message.ToString();
                }
            }
            else
            {
                txtRadDate.SelectedDate = DateTime.Now;
                btn_add.Visible = true;
                btn_edit.Visible = false;

                if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval"))
                {

                    rdbApproval.Enabled = true;
                }
                else
                {

                    rdbApproval.Enabled = false;
                }
            }
        }
Esempio n. 5
0
        private Download ReceiveHtml()
        {
            ConfigBSO configBSO = new ConfigBSO();
            Config config = configBSO.GetAllConfig(Language.language);
            int thumb_w = Convert.ToInt32(config.New_large_w);
            int thumb_h = Convert.ToInt32(config.New_large_h);

            commonBSO commonBSO = new commonBSO();
            string path_thumb = Request.PhysicalApplicationPath.Replace(@"\", "/") + "/Upload/Download/DownloadThumb/";
            string image_thumb = commonBSO.UploadImage(file_image_thumb, path_thumb, thumb_w, thumb_h);

            string path = Request.PhysicalApplicationPath.Replace(@"\", "/") + "/Upload/Download/Files/";
            string file_upload = commonBSO.UploadFile(file_attached, path, 18000000000000);


            Download download = new Download();
            download.DownloadID = (hddDownloadID.Value != "") ? Convert.ToInt32(hddDownloadID.Value) : 0;
            download.CateDownloadID = Convert.ToInt32(ddlCateDownload.SelectedValue);
            download.Title = txtTitle.Text;
            download.ShortDescribe = txtRadShort.Html;
            download.FullDescribe = txtRadFull.Html;
            download.ImageThumb = (image_thumb != "") ? image_thumb : hddImageThumb.Value;
            download.FileName = (file_upload != "") ? file_upload : hddFileName.Value;
            download.Author = txtAuthor.Text;
            download.PostDate = txtRadDate.SelectedDate.Value;
            download.RelationTotal = (hddRelationTotal.Value != "") ? Convert.ToInt32(hddRelationTotal.Value) : 0;
            download.Status = Convert.ToBoolean(rdbStatus.SelectedItem.Value);
            download.Language = Language.language;
            download.Ishot = Convert.ToBoolean(rdbIshot.SelectedValue);
            download.Ishome = Convert.ToBoolean(rdbIshome.SelectedValue);
            download.IsComment = Convert.ToBoolean(rdbComment.SelectedValue);

            download.Isview = (hddIsView.Value != "") ? Convert.ToInt32(hddIsView.Value) : 0;
            download.CommentTotal = (hddCommentTotal.Value != "") ? Convert.ToInt32(hddCommentTotal.Value) : 0;

            download.CreatedUserName = (hddCreateUserName.Value != "") ? hddCreateUserName.Value : Session["Admin_UserName"].ToString();

            download.IsApproval = Convert.ToBoolean(rdbApproval.SelectedValue);
            if (hddApprovalUserName.Value != "")
            {
                download.ApprovalUserName = hddApprovalUserName.Value;
                download.ApprovalDate = Convert.ToDateTime(hddApprovalDate.Value);
            }
            else
                if (Convert.ToBoolean(rdbApproval.SelectedValue))
                {
                    download.ApprovalUserName = Session["Admin_UserName"].ToString();
                    download.ApprovalDate = DateTime.Now;
                }
                else
                {
                    download.ApprovalUserName = "";
                    download.ApprovalDate = DateTime.Now;
                }


            return download;

        }