コード例 #1
0
    public ReturnClass.ReturnDataTable LoadNotice(Notice_Entry n)
    {
        ReturnClass.ReturnDataTable dt = new ReturnClass.ReturnDataTable();
        db_maria_connection         db = new db_maria_connection();

        MySqlParameter[] param = new MySqlParameter[] {
            new MySqlParameter("noticeId", n.NoticeID)
            //new MySqlParameter("district_id",n.district_id)
        };
        string qur = @"select nb.notice_id,nb.district_id,nb.file_id,nb.header,nb.bold,nb.blink,nb.priority,nb.color,nb.image,fd.file_id,fd.File_Header,fd.file_data,fd.mime_type,fd.upload_date,
                              (case when DATE_FORMAT(Publish_Date,'%d/%m/%Y') is null or DATE_FORMAT(Publish_Date,'%d/%m/%Y')='' 
                              then DATE_FORMAT(validity_from,'%d/%m/%Y %h:%m:%s') else DATE_FORMAT(Publish_Date,'%d/%m/%Y') end)Publish_Date, 
                              (case when Validity_From is not null or Validity_From!='' then DATE_FORMAT(Validity_From,'%d/%m/%Y') 
                              else 'Not Available' end)Validity_From, 
                              (case when Validity_To is not null or Validity_To!='' then DATE_FORMAT(Validity_To,'%d/%m/%Y') 
                              else 'Not Available' end)Validity_To, 
                              (case when url is null or url='' then 'Not Available' else url end)url, 
                              (case when Permanent='Y' then 'Yes' when Permanent='N' then 'No' end)permanent, 
                              (case when hyperlink='Y' then 'Yes' when hyperlink='N' then 'No' end)hyperlink, 
                              (case when Active='A' then 'Active' when Active='D' then 'Inactive' end)active, 
                              (case when file_type='I' then 'Internal' when file_type='E' then 'External' 
                              when file_type is null or file_type='' then 'Not Available' end)file_type , nb.district_id, nb.base_dept_id, nb.office_id
                              from notice_board nb
                              left outer join notice_file_details fd on fd.file_id=nb.File_Id
                              where Notice_Id=@noticeId ";

        dt = db.executeSelectQuery(qur, param);
        return(dt);
    }
コード例 #2
0
    public ReturnClass.ReturnBool approve_notice(Notice_Entry ne)
    {
        ReturnClass.ReturnBool rb = new ReturnClass.ReturnBool();
        db_maria_connection    db = new db_maria_connection();

        using (TransactionScope ts = new TransactionScope())
        {
            string           qr1 = @"insert into notice_board_log select * from Notice_Board where Notice_Id=@NoticeID";
            MySqlParameter[] pm  = new MySqlParameter[] {
                new MySqlParameter("NoticeID", ne.NoticeID)
            };

            rb = db.executeInsertQuery(qr1, pm);

            if (rb.status == true)
            {
                string           qr  = " UPDATE Notice_Board SET status=@status where  Notice_Id=@NoticeID  ";
                MySqlParameter[] pm1 = new MySqlParameter[] {
                    new MySqlParameter("NoticeID", ne.NoticeID),
                    new MySqlParameter("status", ne.status)
                    //  new MySqlParameter("district_id",ne.district_id)
                };
                rb = db.executeUpdateQuery(qr, pm1);
                ts.Complete();
            }
        }

        return(rb);
    }
コード例 #3
0
    public ReturnClass.ReturnDataTable pending_for_approval(Notice_Entry ne)
    {
        ReturnClass.ReturnDataTable dts = new ReturnClass.ReturnDataTable();
        db_maria_connection         db  = new db_maria_connection();

        MySqlParameter[] param = new MySqlParameter[]
        {
            new MySqlParameter("Pending", ne.Pending)
            //new MySqlParameter("district_id",ne.district_id)
        };

        string query = "";

        query = @"select nb.status,nb.Notice_Id as Notice_Id,nb.File_Id as File_Id,nb.Header as Header,nb.bold,nb.blink,nb.priority,nb.color,nb.image,fd.mime_type as mime_type,fd.file_data as file_data, 
                    (CASE WHEN Validity_From IS NOT NULL OR Validity_From !='' THEN DATE_FORMAT(Validity_From,'%d/%m/%Y') ELSE 'Not Available' END)Validity_From,  
                    (CASE WHEN Validity_To IS NOT NULL OR Validity_To!='' THEN DATE_FORMAT(Validity_To,'%d/%m/%Y') ELSE 'Not Available' END)Validity_To, 
                    (CASE WHEN DATE_FORMAT(Publish_Date,'%d/%m/%Y') IS NULL OR DATE_FORMAT(Publish_Date,'%d/%m/%Y')='' THEN DATE_FORMAT(validity_from,'%d/%m/%Y') ELSE DATE_FORMAT(Publish_Date,'%d/%m/%Y') END)Publish_Date, 
                    (case when url is null or url='' then 'Not Available' else url end)url, 
                    (case when Permanent='Y' then 'Yes' when Permanent='N' then 'No' end)permanent, 
                    (case when hyperlink='Y' then 'Yes' when hyperlink='N' then 'No' end)hyperlink, 
                    (case when Active='A' then 'Active' when Active='D' then 'Inactive' end)Active, 
                    (case when file_type='I' then 'Internal' when file_type='E' then 'External' end)file_type 
                    from notice_board nb 
                    left outer join notice_file_details fd on nb.file_id=fd.file_id where status=@Pending ";

        dts = db.executeSelectQuery(query, param);
        return(dts);
    }
コード例 #4
0
    //-------------------------pending for approval page---------------------------------------------------------------------//
    public ReturnClass.ReturnBool delete_notice_and_file(Notice_Entry ne)
    {
        ReturnClass.ReturnBool rb = new ReturnClass.ReturnBool();
        db_maria_connection    db = new db_maria_connection();

        using (TransactionScope transScope = new TransactionScope())
        {
            string query = "insert into notice_board_log select * from Notice_Board where Notice_Id=@NoticeID";

            MySqlParameter[] pm = new MySqlParameter[] {
                new MySqlParameter("NoticeID", ne.NoticeID)
            };


            rb = db.executeInsertQuery(query, pm);
            if (rb.status == true)
            {
                string           query2 = @"delete from Notice_Board where Notice_Id=@NoticeID ";
                MySqlParameter[] pm2    = new MySqlParameter[] {
                    new MySqlParameter("NoticeID", ne.NoticeID)
                    // new MySqlParameter("district_id",ne.district_id)
                };
                rb = db.executeDeleteQuery(query2, pm2);
            }
            if (ne.file_id == null)
            {
            }
            else
            {
                if (rb.status == true)
                {
                    string           query3 = "insert into notice_file_details_log select * from notice_file_details where file_id=@file_id";
                    MySqlParameter[] pm3    = new MySqlParameter[] {
                        new MySqlParameter("file_id", ne.file_id)
                    };
                    rb = db.executeInsertQuery(query3, pm3);
                }
                if (rb.status == true)
                {
                    string query4 = "delete from notice_file_details where file_id=@file_id";

                    MySqlParameter[] pm4 = new MySqlParameter[] {
                        new MySqlParameter("file_id", ne.file_id)
                    };
                    rb = db.executeInsertQuery(query4, pm4);
                }
            }

            if (rb.status == true)
            {
                transScope.Complete();
            }
        }

        return(rb);
    }
コード例 #5
0
    public ReturnClass.ReturnDataTable Get_DeptUserManual_File(Notice_Entry bl)
    {
        ReturnClass.ReturnDataTable rd = new ReturnClass.ReturnDataTable();
        db_maria_connection         db = new db_maria_connection();
        string str       = @" SELECT A.Dept_User_Manual_ID, A.User_ID, file_name, content_type as mime_type, file_data, file_description ,Year_Issue,
                       dist.District_Name as dist_name, dept.dept_name as dept_name, ofc.OfficeName as ofc_name 
                       FROM  dept_user_manual_file A 
                       left join districts dist on A.district_id_ofc = dist.District_ID 
                       left join basedepartment dept on A.base_department_id = dept.dept_id 
                       left join office ofc on A.office_id = ofc.NewOfficeCode and dept.dept_id= ofc.BaseDeptCode and dist.District_ID = ofc.DistrictCodeNew 
                       where 1 and 1 ";
        string end_where = "  ORDER BY Year_Issue  DESC  ";
        string and_where = "";

        try
        {
            List <MySqlParameter> pm = new List <MySqlParameter>();

            if (bl.District_id != "0")
            {
                MySqlParameter fa = new MySqlParameter("District_ID", bl.District_id);
                pm.Add(fa);
                and_where += " and A.district_id_ofc = @District_ID ";
            }
            if (bl.Base_dept_id != "0")
            {
                MySqlParameter fa = new MySqlParameter("Base_department_id", bl.Base_dept_id);
                pm.Add(fa);
                and_where += " and base_department_id = @Base_department_id ";
            }
            if (bl.Office_id != "0")
            {
                MySqlParameter fa = new MySqlParameter("Office_id", bl.Office_id);
                pm.Add(fa);
                and_where += " and office_id = @Office_id ";
            }
            if ((bl.IssueYear != "0") && (bl.IssueYear != ""))
            {
                MySqlParameter fa = new MySqlParameter("issueYear", bl.IssueYear);
                pm.Add(fa);
                and_where += " and Year_Issue = @issueYear ";
            }

            str = str + and_where + end_where;
            rd  = db.executeSelectQuery(str, pm.ToArray());
        }
        catch (Exception ex)
        {
            Gen_Error_Rpt.Write_Error("../dio/dl_Dio/Bind_Grid log.txt");
        }
        return(rd);
    }
コード例 #6
0
 public void OfficeBind()
 {
     Notice_Entry bl = new Notice_Entry();
     dl_rti_notice dl = new dl_rti_notice();
     bl.Base_dept_id = ddl_department.SelectedItem.Value;
     bl.District_id = ddl_district.SelectedItem.Value;
     ReturnClass.ReturnDataTable dt = dl.Get_Office_For_Notice(bl);
     ddl_office.DataSource = dt.table;
     ddl_office.DataTextField = "OfficeName";
     ddl_office.DataValueField = "NewOfficeCode";
     ddl_office.DataBind();
     ddl_office.Items.Insert(0, new ListItem("--Select Office--", "0"));
 }
コード例 #7
0
    protected void LinkButton2_Click(object sender, EventArgs e)
    {
        string       Ecode;
        Notice_Entry ne = new Notice_Entry();
        Upload_doc   ud = new Upload_doc();

        ReturnClass.ReturnBool rb = new ReturnClass.ReturnBool();
        dl_rti_notice          dl = new dl_rti_notice();

        Ecode = Request.QueryString["fid"].ToString();
        string lol = "notice_download.aspx?fid=" + Ecode;

        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "key", "window.open(" + "'" + lol + "','_blank');", true);
    }
コード例 #8
0
    public ReturnClass.ReturnDataTable select_file_details(Notice_Entry n)
    {
        ReturnClass.ReturnDataTable dt = new ReturnClass.ReturnDataTable();
        db_maria_connection         db = new db_maria_connection();

        MySqlParameter[] param = new MySqlParameter[] {
            new MySqlParameter("file_id", n.file_id)
        };
        string qur = @"select file_id,File_Header,mime_type,file_data,upload_date from notice_file_details
                       where file_id=@file_id";

        dt = db.executeSelectQuery(qur, param);
        return(dt);
    }
コード例 #9
0
    public void bind_grid()
    {
        ReturnClass.ReturnDataTable dt = new ReturnClass.ReturnDataTable();

        Notice_Entry ne = new Notice_Entry();

        try
        {
            ne.pending = "P";
            //ne.district_id = Session["Dist_Code"].ToString();
            dt = dl.pending_for_approval(ne);
            //if (dt.table.Rows.Count > 0)
            //{
            //    GridView1.DataSource = dt.table;
            //    GridView1.DataBind();
            //}
            //else
            //{
            //    btnapprove.Visible = false;
            //           }

            if (dt.table.Rows.Count > 0)
            {
                GridView1.DataSource = dt.table;
                GridView1.DataBind();
                double c   = Convert.ToInt32(dt.table.Rows.Count.ToString());
                double cal = Math.Ceiling(c / 30);
                if (cal == 0)
                {
                    cal = 1;
                }

                lblTotalBoilers.Text = "Total Records : " + dt.table.Rows.Count.ToString() + " (Page : 1 to " + cal + ")";
            }
            else
            {
                btnapprove.Visible   = false;
                GridView1.DataSource = dt.table;
                GridView1.DataBind();
                lblTotalBoilers.Text = "Total Records : " + dt.table.Rows.Count.ToString();
            }
        }
        catch (Exception ex)
        {
            Gen_Error_Rpt.Write_Error("admin_NewsEdit_List_bind_grid()", ex);
            Utilities.MessageBoxShow(ex.Message);
        }
    }
コード例 #10
0
    public ReturnClass.ReturnDataTable Get_Office_For_Notice(Notice_Entry bl)
    {
        string strquery = @"SELECT NewOfficeCode, OfficeName FROM office WHERE  
                           office.BaseDeptCode=@dept AND office.DistrictCodeNew=@district
                           order by OfficeName ";

        MySqlParameter[] pm = new MySqlParameter[] {
            new MySqlParameter("dept", bl.Base_dept_id),
            new MySqlParameter("district", bl.District_id)
        };
        ReturnClass.ReturnDataTable rd = new ReturnClass.ReturnDataTable();
        db_maria_connection         db = new db_maria_connection();

        rd = db.executeSelectQuery(strquery, pm);
        return(rd);
    }
コード例 #11
0
    protected void lnkDelete_Click(object sender, EventArgs e)
    {
        ReturnClass.ReturnBool rb = new ReturnClass.ReturnBool();
        //dl_dmf_designation dl = new dl_dmf_designation();
        Notice_Entry ne = new Notice_Entry();

        try
        {
            LinkButton  lnkbtn = sender as LinkButton;
            GridViewRow gvrow  = lnkbtn.NamingContainer as GridViewRow;
            ne.file_id  = GridView1.DataKeys[gvrow.RowIndex].Values["file_id"].ToString();
            ne.noticeID = GridView1.DataKeys[gvrow.RowIndex].Values["Notice_Id"].ToString();
            // ne.district_id = Session["Dist_Code"].ToString();
            rb = dl.delete_notice_and_file(ne);

            if (rb.status == true)
            {
                if (Session["language"].ToString() == "en-GB")
                {
                    Utilities.MessageBoxShow("Notice Deleted Successfully");
                }
                else
                {
                    Utilities.MessageBoxShow("सूचना सफलतापूर्वक हटाई गई");
                }
                //  Utilities.MessageBoxShow("Notice Deleted Successfully");
                bind_grid();
            }
            else
            {
                if (Session["language"].ToString() == "en-GB")
                {
                    Utilities.MessageBoxShow("Failed to Deleted");
                }
                else
                {
                    Utilities.MessageBoxShow("सूचना हटाई नहीं जा सकी");
                }
                //  Utilities.MessageBoxShow("Failed to Deleted");
            }
        }

        catch (Exception ex)
        {
        }
    }
コード例 #12
0
    protected void BindDropDownList()
    {
        Upload_doc   bl = new Upload_doc();
        Notice_Entry n  = new Notice_Entry();

        ReturnClass.ReturnBool      rb = new ReturnClass.ReturnBool();
        ReturnClass.ReturnDataTable dt = new ReturnClass.ReturnDataTable();

        dt = dl.bindimage();
        try
        {
            dt = dl.bindimage();
            ddlimage.DataSource = dt.table;

            ddlimage.DataTextField  = "name";
            ddlimage.DataValueField = "value";

            ddlimage.DataBind();
            ddlimage.Items.Insert(0, new ListItem("Select", "0"));
        }
        catch { }
    }
コード例 #13
0
    public ReturnClass.ReturnBool Insert_Notice(Notice_Entry ne)
    {
        ReturnClass.ReturnBool rb = new ReturnClass.ReturnBool();
        db_maria_connection    db = new db_maria_connection();

        MySqlParameter[] param = new MySqlParameter[]
        {
            new MySqlParameter("Header", ne.Header),
            new MySqlParameter("Pernament", ne.Permanent),
            new MySqlParameter("Publish_Date", ne.Publish_date),
            new MySqlParameter("Validity_From", ne.Datefrom),
            new MySqlParameter("Validity_To", ne.Dateto),
            new MySqlParameter("Active", ne.Active),
            new MySqlParameter("Hyperlink", ne.Hyperlink),
            new MySqlParameter("File_Type", ne.Filetype),
            new MySqlParameter("File_Id", ne.file_ID),
            new MySqlParameter("Url", ne.Url),
            new MySqlParameter("Client_Ip", ne.Client_ip),
            new MySqlParameter("User_Id", ne.User_id),
            new MySqlParameter("Date_Time", ne.Datetime),
            new MySqlParameter("Bold", ne.Bold),
            new MySqlParameter("Blink", ne.Blink),
            new MySqlParameter("Priority", ne.Priority),
            new MySqlParameter("Color", ne.Color),
            new MySqlParameter("Image", ne.Image),
            new MySqlParameter("status", ne.status),
            new MySqlParameter("district_id", ne.District_id),
            new MySqlParameter("office_id", ne.Office_id),
            new MySqlParameter("base_dept_id", ne.Base_dept_id)
        };

        string qur = @"insert into Notice_Board(Header,Permanent,Publish_Date,Validity_From,Validity_To,Active,Hyperlink,File_Type,File_Id,Url,Client_Ip,User_Id,Date_Time,
                        bold,blink,priority,color,image,status,district_id, base_dept_id, office_id) 
                        values(@Header,@Pernament,@Publish_Date,@Validity_From,@Validity_To,@Active,@Hyperlink,@File_Type,@File_Id,@Url,@Client_Ip,@User_Id,@Date_Time,
                         @Bold,@Blink,@Priority,@Color,@Image,@status,@district_id,@base_dept_id,@office_id)";

        rb = db.executeInsertQuery(qur, param);
        return(rb);
    }
コード例 #14
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        Notice_Entry ne = new Notice_Entry();
        Upload_doc   ud = new Upload_doc();

        ReturnClass.ReturnBool rb = new ReturnClass.ReturnBool();
        dl_rti_notice          dl = new dl_rti_notice();


        ud.Status = "N";

        if (Session["CheckRefresh"].ToString() == ViewState["CheckRefresh"].ToString())
        {
            Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString());
            if (ddlPermanent.SelectedValue == "Y")
            {
                RequiredFieldValidator10.Enabled             = false;
                RequiredFieldValidator10.ValidationGroup     = "x";
                RequiredFieldValidator9.Enabled              = false;
                RequiredFieldValidator9.ValidationGroup      = "x";
                RegularExpressionValidator10.Enabled         = false;
                RegularExpressionValidator10.ValidationGroup = "x";
                RegularExpressionValidator17.Enabled         = false;
                RegularExpressionValidator17.ValidationGroup = "x";

                RequiredFieldValidator7.Enabled             = true;
                RequiredFieldValidator7.ValidationGroup     = "a";
                RegularExpressionValidator1.Enabled         = true;
                RegularExpressionValidator1.ValidationGroup = "a";
            }
            else if (ddlPermanent.SelectedValue == "N")
            {
                RequiredFieldValidator10.Enabled             = true;
                RequiredFieldValidator9.Enabled              = true;
                RequiredFieldValidator10.ValidationGroup     = "a";
                RequiredFieldValidator9.ValidationGroup      = "a";
                RegularExpressionValidator10.Enabled         = true;
                RegularExpressionValidator10.ValidationGroup = "a";
                RegularExpressionValidator17.Enabled         = true;
                RegularExpressionValidator17.ValidationGroup = "a";

                RequiredFieldValidator7.Enabled             = false;
                RequiredFieldValidator7.ValidationGroup     = "x";
                RegularExpressionValidator1.Enabled         = false;
                RegularExpressionValidator1.ValidationGroup = "x";
            }
            if (ddlHyperlink.SelectedValue == "Y")
            {
                RequiredFieldValidator3.Enabled         = true;
                RequiredFieldValidator3.ValidationGroup = "a";
            }
            else if (ddlHyperlink.SelectedValue == "N")
            {
                RequiredFieldValidator3.Enabled         = false;
                RequiredFieldValidator3.ValidationGroup = "x";
                RequiredFieldValidator6.Enabled         = false;
                RequiredFieldValidator6.ValidationGroup = "x";
                RequiredFieldValidator4.Enabled         = false;
                RequiredFieldValidator4.ValidationGroup = "x";
                regUrl.ValidationGroup = "x";
                regUrl.Enabled         = false;
            }
            if (ddlType.SelectedValue == "E")
            {
                RequiredFieldValidator6.Enabled         = false;
                RequiredFieldValidator6.ValidationGroup = "x";
                RequiredFieldValidator4.Enabled         = true;
                RequiredFieldValidator4.ValidationGroup = "a";
                regUrl.ValidationGroup = "a";
                regUrl.Enabled         = true;
            }
            else if (ddlType.SelectedValue == "I")
            {
                RequiredFieldValidator6.Enabled         = true;
                RequiredFieldValidator6.ValidationGroup = "a";
                RequiredFieldValidator4.Enabled         = false;
                RequiredFieldValidator4.ValidationGroup = "x";
                regUrl.ValidationGroup = "x";
                regUrl.Enabled         = false;
            }

            if (Page.IsValid)
            {
                Boolean st = true;
                try
                {
                    using (TransactionScope ts = new TransactionScope())
                    {
                        ne.District_id  = ddl_district.SelectedValue;
                        ne.Base_dept_id = ddl_department.SelectedValue;
                        ne.Office_id    = ddl_office.SelectedValue;
                        ne.NoticeID     = Request.QueryString["nid"].ToString();
                        ne.Header       = txtHeader.Text;
                        ne.Permanent    = ddlPermanent.SelectedValue;
                        ne.Active       = ddlActive.SelectedValue;
                        ne.Hyperlink    = ddlHyperlink.SelectedValue.ToString();
                        ne.Client_ip    = util.GetClientIpAddress(this.Page);
                        ne.User_id      = Session["username"].ToString();
                        ne.Datetime     = Convert.ToDateTime(System.DateTime.Now).ToString("yyyy/MM/dd HH:mm:ss");

                        if (ddlPermanent.SelectedValue == "N")
                        {
                            ne.Publish_date = null;
                            //string datefrom = Convert.ToDateTime(txtDateFrom.Text.Trim()).ToString("yyyy/MM/dd HH:mm:ss");
                            //string dateto = Convert.ToDateTime(txtDateTo.Text.Trim()).ToString("yyyy/MM/dd HH:mm:ss");
                            //ne.Datefrom = datefrom.ToString();
                            //ne.Dateto = dateto.ToString();

                            DateTime datefrom = DateTime.ParseExact(txtDateFrom.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                            ne.Datefrom = datefrom.ToString("yyyy/MM/dd HH:mm:ss");
                            DateTime dateto = DateTime.ParseExact(txtDateTo.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                            ne.Dateto = dateto.ToString("yyyy/MM/dd HH:mm:ss");
                        }
                        else if (ddlPermanent.SelectedValue == "Y")
                        {
                            DateTime Publish_date = DateTime.ParseExact(txtPublishDate.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                            ne.Publish_date = Publish_date.ToString("yyyy/MM/dd HH:mm:ss");
                            //ne.Publish_date = Convert.ToDateTime(txtPublishDate.Text.Trim()).ToString("yyyy/MM/dd HH:mm:ss");
                            ne.Datefrom = null;
                            ne.Dateto   = null;
                        }
                        if (ddlHyperlink.SelectedValue == "Y")
                        {
                            ne.Filetype = ddlType.SelectedValue;
                            if (ddlType.SelectedValue == "I")
                            {
                                ne.Url = null;

                                if (FileUpload1.HasFile)
                                {
                                    if (FileUpload1.PostedFile.ContentType == "application/x-pdf" || FileUpload1.PostedFile.ContentType == "application/pdf")
                                    {
                                        if (FileUpload1.PostedFile.ContentLength > maxSizePdf)
                                        {
                                            if (Session["language"].ToString() == "en-GB")
                                            {
                                                Utilities.MessageBoxShow("This PDF File Is too Big...Maximum Size allowed is 10 Mb");
                                            }
                                            else
                                            {
                                                Utilities.MessageBoxShow("यह PDF बहुत बड़ा है...अधिकतम साइज़ 10 Mb की अनुमति है");
                                            }
                                            // Utilities.MessageBoxShow("This PDF File Is too Big...Maximum Size allowed is 10 Mb");
                                            st = false;
                                        }
                                    }
                                    else if (FileUpload1.PostedFile.ContentType == "image/jpg" || FileUpload1.PostedFile.ContentType == "image/jpeg")
                                    {
                                        if (FileUpload1.PostedFile.ContentLength > maxSizeJpg)
                                        {
                                            if (Session["language"].ToString() == "en-GB")
                                            {
                                                Utilities.MessageBoxShow("This JPG File Is too Big...Maximum Size allowed is 1 Mb");
                                            }
                                            else
                                            {
                                                Utilities.MessageBoxShow("यह JPG बहुत बड़ा है...अधिकतम साइज़ 1 Mb की अनुमति है");
                                            }
                                            // Utilities.MessageBoxShow("This JPG File Is too Big...Maximum Size allowed is 1 Mb");
                                            st = false;
                                        }
                                    }
                                    if (st)
                                    {
                                        if (FileUpload1.PostedFile.ContentType == "application/x-pdf" || FileUpload1.PostedFile.ContentType == "application/pdf" || FileUpload1.PostedFile.ContentType == "image/jpg" || FileUpload1.PostedFile.ContentType == "image/jpeg")
                                        {
                                            string file_ext = Path.GetExtension(FileUpload1.PostedFile.FileName).ToString();

                                            Stream fs = default(Stream);
                                            fs = FileUpload1.PostedFile.InputStream;
                                            BinaryReader br1      = new BinaryReader(fs);
                                            byte[]       pdfbytes = br1.ReadBytes(FileUpload1.PostedFile.ContentLength);
                                            ud.File_Extn   = file_ext;
                                            ud.File_Data   = pdfbytes;
                                            ud.Filename    = FileUpload1.PostedFile.FileName;
                                            ud.Client_ip   = util.GetClientIpAddress(this.Page);
                                            ud.Upload_Date = Convert.ToDateTime(System.DateTime.Now).ToString("yyyy/MM/dd HH:mm:ss");
                                            ud.User_id     = Session["username"].ToString();
                                        }
                                        else
                                        {
                                            if (Session["language"].ToString() == "en-GB")
                                            {
                                                Utilities.MessageBoxShow("Only PDF and JPG files are allowed");
                                            }
                                            else
                                            {
                                                Utilities.MessageBoxShow(" केवल PDF और JPG फाईल की अनुमति है");
                                            }
                                            //Utilities.MessageBoxShow("Only PDF and JPG files are allowed");
                                            st = false;
                                        }
                                    }
                                }
                            }
                            else if (ddlType.SelectedValue == "E")
                            {
                                ne.file_id = null;
                                ne.Url     = txtUrl.Text.Trim();

                                nb = ",File_Id=@file_id";
                                int fid = Convert.ToInt32(Request.QueryString["fid"].ToString());
                                if (fid != 0)
                                {
                                    ud.file_id = Request.QueryString["fid"].ToString();
                                    rb         = dl.update_file_details(ud);
                                }
                            }
                        }
                        else if (ddlHyperlink.SelectedValue == "N")
                        {
                            ud.file_id      = null;
                            ud.File_Extn    = null;
                            ud.Content_type = null;
                            ud.File_Data    = new byte[] { };
                            ud.URL          = null;
                            // nb = ",File_Id=@File_id";
                            // nb = ",File_Id=@file_id";
                            int fid = Convert.ToInt32(Request.QueryString["fid"].ToString());
                            if (fid != 0)
                            {
                                ud.file_ID = Convert.ToInt32(Request.QueryString["fid"].ToString());
                                rb         = dl.update_file_details(ud);
                            }
                        }

                        if (FileUpload1.HasFile)
                        {
                            if (st)
                            {
                                int fid = Convert.ToInt32(Request.QueryString["fid"].ToString());
                                if (fid == 0)
                                {
                                    //if (rb.status == true)
                                    //{
                                    ud.Filename    = FileUpload1.PostedFile.FileName;
                                    ud.Client_ip   = util.GetClientIpAddress(this.Page);
                                    ud.User_id     = Session["username"].ToString();
                                    ud.Upload_Date = Convert.ToDateTime(System.DateTime.Now).ToString("yyyy/MM/dd HH:mm:ss");
                                    rb             = dl.Insert_FileDetails(ud);
                                    // }

                                    if (rb.status == true)
                                    {
                                        ne.file_ID = Convert.ToInt32(dl.Get_Max_ID().table.Rows[0][0].ToString());
                                        //nb = ",File_Id=@file_ID";
                                    }
                                }

                                else if (fid != 0)
                                {
                                    ud.file_id = Request.QueryString["fid"].ToString();
                                    ud.Status  = "Y";
                                    rb         = dl.update_file_details(ud);
                                }
                            }
                        }

                        if (st)
                        {
                            if (RadioButtonListbold.SelectedValue == "Yes")
                            {
                                ne.Bold = "Y";
                            }
                            else
                            {
                                ne.Bold = "N";
                            }
                            if (RadioButtonListblink.SelectedValue == "Yes")
                            {
                                ne.Blink = "Y";
                            }
                            else
                            {
                                ne.Blink = "N";
                            }
                            ne.Priority = ddlpriority.SelectedValue;
                            ne.Color    = color.Text.Trim();

                            if (ddlimage.SelectedValue == "")
                            {
                                ne.Image = Image1.ImageUrl;
                            }
                            else
                            {
                                //ne.Image = ddlimage.SelectedValue;
                                ne.Image = ddlimage.SelectedItem.Text;
                            }

                            if (ne.Image.StartsWith(".."))
                            {
                                string imgPath     = ne.Image;
                                string cut_imgPath = imgPath.Remove(0, 3);
                                ne.Image = cut_imgPath;
                            }

                            rb = dl.update_notice(ne);
                            // rb = dl.update_notice(ne, nb);
                        }

                        if (rb.status == true)
                        {
                            ts.Complete();
                            clear();
                            if (Session["language"].ToString() == "en-GB")
                            {
                                Utilities.MessageBoxShow_Redirect("Notice Updated successfully", "NoticeEdit_List.aspx");
                            }
                            else
                            {
                                Utilities.MessageBoxShow_Redirect("रिकार्ड सफलतापूर्वक सुरक्षित हुआ", "NoticeEdit_List.aspx");
                            }
                            // Utilities.MessageBoxShow_Redirect("Notice Updated successfully", "NoticeEdit_List.aspx");
                        }
                    }
                }
                catch (Exception ex)
                {
                    if (Session["language"].ToString() == "en-GB")
                    {
                        Utilities.MessageBoxShow("Record could not be updated.");
                    }
                    else
                    {
                        Utilities.MessageBoxShow("रिकार्ड सुरक्षित नहीं हुआ |");
                    }
                    // Utilities.MessageBoxShow("Record could not be updated.");
                    Gen_Error_Rpt.Write_Error("admin_NewsEdit_Form.aspx_btnUpdate_Click", ex);
                }
            }
        }
    }
コード例 #15
0
    public void show()
    {
        ReturnClass.ReturnDataTable dt = new ReturnClass.ReturnDataTable();
        dl_rti_notice dl = new dl_rti_notice();
        Notice_Entry  ba = new Notice_Entry();

        ba.NoticeID = Request.QueryString["nid"].ToString();
        try
        {
            dt = dl.LoadNotice(ba);

            if (dt.table.Rows.Count > 0)
            {
                ddl_department.SelectedValue = dt.table.Rows[0]["base_dept_id"].ToString();
                ddl_district.SelectedValue   = dt.table.Rows[0]["district_id"].ToString();
                OfficeBind();
                ddl_office.SelectedValue = dt.table.Rows[0]["office_id"].ToString();
                txtHeader.Text           = dt.table.Rows[0]["header"].ToString();
                //lblpreview.Text = txtHeader.Text;
                //Image1.ImageUrl = dt.table.Rows[0]["image"].ToString();

                if (dt.table.Rows[0]["permanent"].ToString() == "Yes")
                {
                    ddlPermanent.SelectedValue = "Y";
                    //divPublishDate.Visible = true;
                    // txtPublishDate.Text = Convert.ToDateTime(dt.table.Rows[0]["Publish_Date"]).ToString("dd/MM/yyyy HH:mm:ss");
                    txtPublishDate.Text                          = Convert.ToString(dt.table.Rows[0]["Publish_Date"].ToString());
                    RequiredFieldValidator9.Enabled              = false;
                    RequiredFieldValidator9.ValidationGroup      = "x";
                    RegularExpressionValidator10.Enabled         = false;
                    RegularExpressionValidator10.ValidationGroup = "x";
                    RequiredFieldValidator10.Enabled             = false;
                    RequiredFieldValidator10.ValidationGroup     = "x";
                    RegularExpressionValidator17.Enabled         = false;
                    RegularExpressionValidator17.ValidationGroup = "x";
                }
                else if (dt.table.Rows[0]["permanent"].ToString() == "No")
                {
                    ddlPermanent.SelectedValue = "N";
                    // divPublishDate.Visible = false;
                    // divFrom.Visible = true;
                    // divTo.Visible = true;
                    txtDateFrom.Text = Convert.ToString(dt.table.Rows[0]["Validity_From"].ToString());
                    txtDateTo.Text   = Convert.ToString(dt.table.Rows[0]["Validity_To"].ToString());
                    RequiredFieldValidator7.Enabled             = false;
                    RequiredFieldValidator7.ValidationGroup     = "x";
                    RegularExpressionValidator1.Enabled         = false;
                    RegularExpressionValidator1.ValidationGroup = "x";
                }
                if (dt.table.Rows[0]["active"].ToString() == "Active")
                {
                    ddlActive.SelectedValue = "A";
                }
                else if (dt.table.Rows[0]["active"].ToString() == "Inactive")
                {
                    ddlActive.SelectedValue = "D";
                }
                if (dt.table.Rows[0]["hyperlink"].ToString() == "Yes")
                {
                    ddlHyperlink.SelectedValue              = "Y";
                    RequiredFieldValidator3.Enabled         = false;
                    RequiredFieldValidator3.ValidationGroup = "x";
                    //divType.Visible = true;
                }
                else if (dt.table.Rows[0]["hyperlink"].ToString() == "No")
                {
                    ddlHyperlink.SelectedValue              = "N";
                    RequiredFieldValidator3.Enabled         = false;
                    RequiredFieldValidator3.ValidationGroup = "x";
                    RequiredFieldValidator6.Enabled         = false;
                    RequiredFieldValidator6.ValidationGroup = "x";
                    RequiredFieldValidator4.Enabled         = false;
                    RequiredFieldValidator4.ValidationGroup = "x";
                    regUrl.ValidationGroup = "x";
                    regUrl.Enabled         = false;
                }
                else
                {
                    RequiredFieldValidator3.Enabled         = true;
                    RequiredFieldValidator3.ValidationGroup = "a";
                }
                if (dt.table.Rows[0]["file_type"].ToString() == "Internal")
                {
                    ddlType.SelectedValue = "I";
                    //divFileUpload.Visible = true;
                    RequiredFieldValidator6.Enabled         = true;
                    RequiredFieldValidator6.ValidationGroup = "a";
                    RequiredFieldValidator4.Enabled         = false;
                    RequiredFieldValidator4.ValidationGroup = "x";
                    regUrl.ValidationGroup = "x";
                    regUrl.Enabled         = false;
                }
                else if (dt.table.Rows[0]["file_type"].ToString() == "External")
                {
                    ddlType.SelectedValue = "E";
                    //divUrl.Visible = true;
                    txtUrl.Text = dt.table.Rows[0]["url"].ToString();
                    RequiredFieldValidator6.Enabled         = false;
                    RequiredFieldValidator6.ValidationGroup = "x";
                }
                if (dt.table.Rows[0]["bold"].ToString() == "Y")
                {
                    RadioButtonListbold.SelectedValue = "Yes";
                }
                else if (dt.table.Rows[0]["bold"].ToString() == "N")
                {
                    RadioButtonListbold.SelectedValue = "No";
                }
                if (dt.table.Rows[0]["blink"].ToString() == "Y")
                {
                    RadioButtonListblink.SelectedValue = "Yes";
                }
                else if (dt.table.Rows[0]["blink"].ToString() == "N")
                {
                    RadioButtonListblink.SelectedValue = "No";
                }
                if (dt.table.Rows[0]["priority"].ToString() == "H")
                {
                    ddlpriority.SelectedValue = "H";
                }
                else if (dt.table.Rows[0]["priority"].ToString() == "M")
                {
                    ddlpriority.SelectedValue = "M";
                }
                else if (dt.table.Rows[0]["priority"].ToString() == "L")
                {
                    ddlpriority.SelectedValue = "L";
                }
                color.Text = dt.table.Rows[0]["color"].ToString();
                // ColorPicker1.SelectedColor = color.Text;
            }
        }
        catch (Exception ex)
        {
            Gen_Error_Rpt.Write_Error("admin_NewsEdit_Form.aspx_show()", ex);
        }
    }
コード例 #16
0
    protected void btnapprove_Click(object sender, EventArgs e)
    {
        ReturnClass.ReturnBool rb = new ReturnClass.ReturnBool();
        // dl_dmf_designation dl = new dl_dmf_designation();
        Notice_Entry ne = new Notice_Entry();


        try
        {
            if (GridView1.Rows.Count < 1)
            {
                Utilities.MessageBoxShow("No Record");
                return;
            }

            foreach (GridViewRow row in GridView1.Rows)
            {
                if (row.RowType == DataControlRowType.DataRow)
                {
                    CheckBox chkRowCheck = (row.Cells[11].FindControl("chk_approve") as CheckBox);
                    if (chkRowCheck.Checked == true)
                    {
                        ne.file_id  = GridView1.DataKeys[row.RowIndex].Values["file_id"].ToString();
                        ne.noticeID = GridView1.DataKeys[row.RowIndex].Values["Notice_Id"].ToString();
                        ne.Status   = "A";
                        // ne.district_id = Session["Dist_Code"].ToString();
                        rb = dl.approve_notice(ne);
                    }
                }
            }

            if (rb.status == true)
            {
                if (Session["language"].ToString() == "en-GB")
                {
                    Utilities.MessageBoxShow("Approve Successfully");
                }
                else
                {
                    Utilities.MessageBoxShow("सफलतापूर्वक स्वीकृत");
                }
                // Utilities.MessageBoxShow("approve successfully");
                bind_grid();
            }
            else
            {
                if (Session["language"].ToString() == "en-GB")
                {
                    Utilities.MessageBoxShow("Approve Failed");
                }
                else
                {
                    Utilities.MessageBoxShow("अस्वीकृत");
                }
                //  Utilities.MessageBoxShow(" Not approve successfully");
            }
        }
        catch (Exception ex)
        {
        }
    }
コード例 #17
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        Upload_doc   bl = new Upload_doc();
        Notice_Entry n  = new Notice_Entry();

        ReturnClass.ReturnBool rb = new ReturnClass.ReturnBool();

        if (Session["CheckRefresh"].ToString() == ViewState["CheckRefresh"].ToString())
        {
            Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString());
            if (ddlPermanent.SelectedValue == "Y")
            {
                RequiredFieldValidator10.Enabled             = false;
                RequiredFieldValidator10.ValidationGroup     = "x";
                RequiredFieldValidator9.Enabled              = false;
                RequiredFieldValidator9.ValidationGroup      = "x";
                RegularExpressionValidator10.Enabled         = false;
                RegularExpressionValidator10.ValidationGroup = "x";
                RegularExpressionValidator17.Enabled         = false;
                RegularExpressionValidator17.ValidationGroup = "x";

                RequiredFieldValidator7.Enabled             = true;
                RequiredFieldValidator7.ValidationGroup     = "a";
                RegularExpressionValidator1.Enabled         = true;
                RegularExpressionValidator1.ValidationGroup = "a";
            }
            else if (ddlPermanent.SelectedValue == "N")
            {
                RequiredFieldValidator10.Enabled             = true;
                RequiredFieldValidator9.Enabled              = true;
                RequiredFieldValidator10.ValidationGroup     = "a";
                RequiredFieldValidator9.ValidationGroup      = "a";
                RegularExpressionValidator10.Enabled         = true;
                RegularExpressionValidator10.ValidationGroup = "a";
                RegularExpressionValidator17.Enabled         = true;
                RegularExpressionValidator17.ValidationGroup = "a";

                RequiredFieldValidator7.Enabled             = false;
                RequiredFieldValidator7.ValidationGroup     = "x";
                RegularExpressionValidator1.Enabled         = false;
                RegularExpressionValidator1.ValidationGroup = "x";
            }
            if (ddlHyperlink.SelectedValue == "Y")
            {
                RequiredFieldValidator3.Enabled         = true;
                RequiredFieldValidator3.ValidationGroup = "a";
            }
            else if (ddlHyperlink.SelectedValue == "N")
            {
                RequiredFieldValidator3.Enabled         = false;
                RequiredFieldValidator3.ValidationGroup = "x";
                RequiredFieldValidator6.Enabled         = false;
                RequiredFieldValidator6.ValidationGroup = "x";
                RequiredFieldValidator4.Enabled         = false;
                RequiredFieldValidator4.ValidationGroup = "x";
                regUrl.ValidationGroup = "x";
                regUrl.Enabled         = false;
            }
            if (ddlType.SelectedValue == "E")
            {
                RequiredFieldValidator6.Enabled         = false;
                RequiredFieldValidator6.ValidationGroup = "x";
                RequiredFieldValidator4.Enabled         = true;
                RequiredFieldValidator4.ValidationGroup = "a";
                regUrl.ValidationGroup = "a";
                regUrl.Enabled         = true;
            }
            else if (ddlType.SelectedValue == "I")
            {
                RequiredFieldValidator6.Enabled         = true;
                RequiredFieldValidator6.ValidationGroup = "a";
                RequiredFieldValidator4.Enabled         = false;
                RequiredFieldValidator4.ValidationGroup = "x";
                regUrl.ValidationGroup = "x";
                regUrl.Enabled         = false;
            }
            if (HiddenField1.Value == "0" || HiddenField1.Value == "Select")
            {
                RFV_Image_Icon.ValidationGroup = "a";
                RFV_Image_Icon.Enabled         = true;
            }
            else
            {
                RFV_Image_Icon.ValidationGroup = "x";
                RFV_Image_Icon.Enabled         = false;
            }

            if (Page.IsValid)
            {
                Boolean st = true;
                try
                {
                    using (TransactionScope ts = new TransactionScope())
                    {
                        n.District_id  = ddl_district.SelectedValue;// Session["Dist_Code"].ToString();
                        n.Base_dept_id = ddl_department.SelectedValue;
                        n.Office_id    = ddl_office.SelectedValue;

                        n.Header    = txtHeader.Text.Trim();
                        n.Permanent = ddlPermanent.SelectedValue;
                        n.Active    = ddlActive.SelectedValue;
                        n.Hyperlink = ddlHyperlink.SelectedValue.ToString();
                        n.Client_ip = util.GetClientIpAddress(this.Page);
                        n.User_id   = Session["username"].ToString();
                        //  n.Datetime = Convert.ToDateTime(System.DateTime.Now).ToString("yyyy/MM/dd HH:mm:ss");
                        DateTime today = DateTime.Today;
                        n.Datetime = today.ToString("yyyy/MM/dd");
                        if (ddlPermanent.SelectedValue == "N")
                        {
                            n.Publish_date = null;
                            //string datefrom = Convert.ToDateTime(txtDateFrom.Text.Trim()).ToString("yyyy/MM/dd HH:mm:ss");
                            //string dateto = Convert.ToDateTime(txtDateTo.Text.Trim()).ToString("yyyy/MM/dd HH:mm:ss");
                            //n.Datefrom = datefrom.ToString();
                            //n.Dateto = dateto.ToString();

                            DateTime datefrom = DateTime.ParseExact(txtDateFrom.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                            n.Datefrom = datefrom.ToString("yyyy/MM/dd HH:mm:ss");
                            DateTime dateto = DateTime.ParseExact(txtDateTo.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                            n.Dateto = dateto.ToString("yyyy/MM/dd HH:mm:ss");
                        }
                        else if (ddlPermanent.SelectedValue == "Y")
                        {
                            DateTime Publish_date = DateTime.ParseExact(txtPublishDate.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                            n.Publish_date = Publish_date.ToString("yyyy/MM/dd HH:mm:ss");

                            //n.Publish_date = Convert.ToDateTime(txtPublishDate.Text.Trim()).ToString("yyyy/MM/dd HH:mm:ss");
                            n.Datefrom = null;
                            n.Dateto   = null;
                        }

                        if (ddlHyperlink.SelectedValue == "Y")
                        {
                            n.Filetype = ddlType.SelectedValue;
                            if (ddlType.SelectedValue == "I")
                            {
                                if (FileUpload1.HasFile)
                                {
                                    if (FileUpload1.PostedFile.ContentType == "application/x-pdf" || FileUpload1.PostedFile.ContentType == "application/pdf")
                                    {
                                        if (FileUpload1.PostedFile.ContentLength > maxSizePdf)
                                        {
                                            if (Session["language"].ToString() == "en-GB")
                                            {
                                                Utilities.MessageBoxShow("This PDF File Is too Big...Maximum Size allowed is 10 Mb");
                                            }
                                            else
                                            {
                                                Utilities.MessageBoxShow("यह PDF बहुत बड़ा है...अधिकतम साइज़ 10 Mb की अनुमति है");
                                            }
                                            //  Utilities.MessageBoxShow("This PDF File Is too Big...Maximum Size allowed is 10 Mb");
                                            st = false;
                                            preview();
                                        }
                                    }
                                    else if (FileUpload1.PostedFile.ContentType == "image/jpg" || FileUpload1.PostedFile.ContentType == "image/jpeg")
                                    {
                                        if (FileUpload1.PostedFile.ContentLength > maxSizeJpg)
                                        {
                                            if (Session["language"].ToString() == "en-GB")
                                            {
                                                Utilities.MessageBoxShow("This JPG File Is too Big...Maximum Size allowed is 1 Mb");
                                            }
                                            else
                                            {
                                                Utilities.MessageBoxShow("यह JPG बहुत बड़ा है...अधिकतम साइज़ 1 Mb की अनुमति है");
                                            }
                                            //Utilities.MessageBoxShow("This JPG File Is too Big...Maximum Size allowed is 1 Mb");
                                            st = false;
                                            preview();
                                        }
                                    }
                                    if (st)
                                    {
                                        if (FileUpload1.PostedFile.ContentType == "application/x-pdf" || FileUpload1.PostedFile.ContentType == "application/pdf" || FileUpload1.PostedFile.ContentType == "image/jpg" || FileUpload1.PostedFile.ContentType == "image/jpeg")
                                        {
                                            //string content_type = FileUpload1.PostedFile.ContentType.ToString();
                                            string file_ext = Path.GetExtension(FileUpload1.PostedFile.FileName).ToString();

                                            Stream fs = default(Stream);
                                            fs = FileUpload1.PostedFile.InputStream;
                                            BinaryReader br1      = new BinaryReader(fs);
                                            byte[]       pdfbytes = br1.ReadBytes(FileUpload1.PostedFile.ContentLength);
                                            bl.File_Extn = file_ext;
                                            bl.File_Data = pdfbytes;
                                            bl.URL       = null;
                                            bl.Filename  = FileUpload1.PostedFile.FileName;
                                        }
                                        else
                                        {
                                            if (Session["language"].ToString() == "en-GB")
                                            {
                                                Utilities.MessageBoxShow("Only PDF and JPG files are allowed");
                                            }
                                            else
                                            {
                                                Utilities.MessageBoxShow(" केवल PDF और JPG फाईल की अनुमति है");
                                            }
                                            // Utilities.MessageBoxShow("Only PDF and JPG files are allowed");
                                            st = false;
                                            preview();
                                        }
                                    }
                                }
                            }
                            else if (ddlType.SelectedValue == "E")
                            {
                                n.File_id = null;
                                n.url     = txtUrl.Text.Trim();
                            }
                        }
                        else if (ddlHyperlink.SelectedValue == "N")
                        {
                            bl.File_id      = null;
                            bl.File_Extn    = null;
                            bl.Content_type = null;
                            bl.File_Data    = new byte[] { };
                            bl.URL          = null;
                            bl.Filename     = null;
                        }
                        if (FileUpload1.HasFiles)
                        {
                            if (st)
                            {
                                bl.Filename    = FileUpload1.PostedFile.FileName;
                                bl.Client_ip   = util.GetClientIpAddress(this.Page);
                                bl.User_id     = Session["username"].ToString();
                                bl.Upload_Date = Convert.ToDateTime(System.DateTime.Now).ToString("yyyy/MM/dd HH:mm:ss");


                                rb = dl.Insert_FileDetails(bl); // inserting file details..

                                if (rb.status == true)
                                {
                                    n.file_ID = Convert.ToInt32(dl.Get_Max_ID().table.Rows[0][0].ToString());
                                }
                            }
                        }

                        if (st)
                        {
                            //new
                            if (RadioButtonListbold.SelectedValue == "Yes")
                            {
                                n.Bold = "Y";
                            }
                            else
                            {
                                n.Bold = "N";
                            }
                            if (RadioButtonListblink.SelectedValue == "Yes")
                            {
                                n.Blink = "Y";
                            }
                            else
                            {
                                n.Blink = "N";
                            }
                            n.Priority = ddlpriority.SelectedValue;
                            n.Color    = color.Text.Trim();
                            // n.Image = ddlimage.SelectedItem.Text;
                            string imgPath     = HiddenField1.Value.ToString();
                            string cut_imgPath = imgPath.Remove(0, 3);
                            n.Image  = cut_imgPath; //HiddenField1.Value;
                            n.status = "P";

                            rb = dl.Insert_Notice(n); // inserting notice details
                        }

                        if (rb.status == true)
                        {
                            ts.Complete();
                            if (Session["language"].ToString() == "en-GB")
                            {
                                Utilities.MessageBoxShow_Redirect("Record Saved Successfully", "../admin/notice_entry.aspx");
                            }
                            else
                            {
                                Utilities.MessageBoxShow_Redirect("रिकार्ड सफलतापूर्वक सुरक्षित हुआ", "../admin/notice_entry.aspx");
                            }
                            // Utilities.MessageBoxShow_Redirect("Record Save Successfully", "../admin/notice_entry.aspx");
                            clear();

                            // BindDropDownList();
                            // BindTitles();
                        }
                    }
                }
                catch (Exception ex)
                {
                    rb.status = false;
                    if (Session["language"].ToString() == "en-GB")
                    {
                        Utilities.MessageBoxShow("Record could not be saved.");
                    }
                    else
                    {
                        Utilities.MessageBoxShow("रिकार्ड सुरक्षित नहीं हुआ |");
                    }
                    //  Utilities.MessageBoxShow("Record could not be saved.");
                    Gen_Error_Rpt.Write_Error("Notice_Entry.aspx_btnSubmit_Click", ex);
                }
            }
        }
    }
コード例 #18
0
    public ReturnClass.ReturnDataTable Get_NoticeRecords(Notice_Entry bl)
    {
        ReturnClass.ReturnDataTable rd = new ReturnClass.ReturnDataTable();
        db_maria_connection         db = new db_maria_connection();
        string str       = @" SELECT A.Notice_Id, Header, A.File_Id,  DATE_FORMAT(Validity_From,'%d/%m/%Y') as publishdate, 
                       ( CASE WHEN File_Header is NULL THEN 'No File' ELSE File_Header END ) as filename, mime_type, file_data, 
                       dist.District_Name as dist_name, dept.dept_name as dept_name, ofc.OfficeName as ofc_name 
                       FROM  notice_board A left join notice_file_details B on A.File_Id=B.file_id 
                       left join districts dist on A.district_id = dist.District_ID 
                       left join basedepartment dept on A.base_dept_id = dept.dept_id 
                       left join office ofc on A.office_id = ofc.NewOfficeCode and dept.dept_id= ofc.BaseDeptCode and dist.District_ID = ofc.DistrictCodeNew 
                       where 1 and 1 ";
        string end_where = "  ORDER BY Validity_From  DESC  ";
        string and_where = "";

        try
        {
            List <MySqlParameter> pm = new List <MySqlParameter>();

            if (bl.NoticeID != null && bl.NoticeID != "")
            {
                MySqlParameter fa = new MySqlParameter("notice_id", "%" + bl.NoticeID + "%");
                pm.Add(fa);
                and_where += " and A.Notice_Id LIKE @notice_id ";
            }
            if (bl.Header != null && bl.Header != "")
            {
                MySqlParameter fa = new MySqlParameter("Header", "%" + bl.Header + "%");
                pm.Add(fa);
                and_where += " and Header LIKE  @Header  ";
            }
            if (bl.Validity_From != null && bl.Validity_From != "" && bl.Validity_To != null & bl.Validity_To != "")
            {
                MySqlParameter fa = new MySqlParameter("Start_Date", bl.Validity_From);
                pm.Add(fa);
                fa = new MySqlParameter("End_Date", bl.Validity_To);
                pm.Add(fa);
                and_where += " and ( Validity_From >=  @Start_Date  and Validity_To <=  @End_Date ) ";
            }
            else if (bl.Validity_From != null && bl.Validity_From != "" && (bl.Validity_To == null || bl.Validity_To == ""))
            {
                MySqlParameter fa = new MySqlParameter("Start_Date", bl.Validity_From);
                pm.Add(fa);
                fa = new MySqlParameter("NextDate", bl.Next_date);
                pm.Add(fa);
                and_where += " and startdate >= @Start_Date and  startdate < @NextDate ";
            }

            if (bl.KeywordSearch != null && bl.KeywordSearch != "")
            {
                MySqlParameter fa = new MySqlParameter("KeywordSearch", "%" + bl.KeywordSearch + "%");
                pm.Add(fa);
                and_where += " and Notice_keyword LIKE  @KeywordSearch ";
            }
            if (bl.District_id != "0")
            {
                MySqlParameter fa = new MySqlParameter("District_ID", bl.District_id);
                pm.Add(fa);
                and_where += " and A.district_id = @District_ID ";
            }
            if (bl.Base_dept_id != "0")
            {
                MySqlParameter fa = new MySqlParameter("Base_department_id", bl.Base_dept_id);
                pm.Add(fa);
                and_where += " and base_dept_id = @Base_department_id ";
            }
            if (bl.Office_id != "0")
            {
                MySqlParameter fa = new MySqlParameter("Office_id", bl.Office_id);
                pm.Add(fa);
                and_where += " and office_id = @Office_id ";
            }
            str = str + and_where + end_where;
            rd  = db.executeSelectQuery(str, pm.ToArray());
        }
        catch (Exception ex)
        {
            Gen_Error_Rpt.Write_Error("../dio/dl_Dio/Bind_Grid log.txt");
        }
        return(rd);
    }
コード例 #19
0
    public ReturnClass.ReturnDataTable load_FilterData(Notice_Entry ne)
    {
        ReturnClass.ReturnDataTable dts = new ReturnClass.ReturnDataTable();
        db_maria_connection         db  = new db_maria_connection();

        MySqlParameter[] param = new MySqlParameter[]
        {
            new MySqlParameter("Header", "%" + ne.Header + "%"),
            new MySqlParameter("Validity_From", ne.Datefrom),
            new MySqlParameter("Validity_To", ne.Dateto),
            new MySqlParameter("district_id", ne.district_id),
            new MySqlParameter("active", ne.active),
            new MySqlParameter("status", ne.status)
        };

        string query = "", where = "";

        query  = @"select nb.Notice_Id as Notice_Id,nb.File_Id as File_Id,nb.Header as Header,nb.bold,nb.blink,nb.priority,nb.color,nb.image,fd.mime_type as mime_type,fd.file_data as file_data,nb.district_id,
                    (CASE WHEN Validity_From IS NOT NULL OR Validity_From !='' THEN DATE_FORMAT(Validity_From,'%d/%m/%Y') ELSE 'Not Available' END)Validity_From,  
                    (CASE WHEN Validity_To IS NOT NULL OR Validity_To!='' THEN DATE_FORMAT(Validity_To,'%d/%m/%Y') ELSE 'Not Available' END)Validity_To, 
                    (CASE WHEN DATE_FORMAT(Publish_Date,'%d/%m/%Y') IS NULL OR DATE_FORMAT(Publish_Date,'%d/%m/%Y')='' THEN DATE_FORMAT(validity_from,'%d/%m/%Y') ELSE DATE_FORMAT(Publish_Date,'%d/%m/%Y') END)Publish_Date, 
                    (case when url is null or url='' then 'Not Available' else url end)url, 
                    (case when Permanent='Y' then 'Yes' when Permanent='N' then 'No' end)permanent, 
                    (case when hyperlink='Y' then 'Yes' when hyperlink='N' then 'No' end)hyperlink, 
                    (case when Active='A' then 'Active' when Active='D' then 'Inactive' end)Active, 
                    (case when file_type='I' then 'Internal' when file_type='E' then 'External' end)file_type 
                    from notice_board nb 
                    left outer join notice_file_details fd on nb.file_id=fd.file_id  
                    where 1=1";
        where += " and nb.district_id=@district_id   ";
        if (ne.Subject_status == "Y")
        {
            //where += "and Header like '%'+ @Header +'%'";
            where += " and nb.Header like @Header ";
        }
        else
        {
        }

        if (ne.Validity_status == "A")
        {
//            where += @" and (permanent = 'N' AND
//                          Date_Format(NOW(),'%d/%m/%Y') between Date_Format(validity_from,'%d/%m/%Y' ) AND Date_Format(Validity_To, '%d/%m/%Y'))
//                          OR (permanent = 'Y' and (Date_Format(NOW(),'%d/%m/%Y') >= Date_Format(Publish_Date,'%d/%m/%Y'))) ";

            where += @" and case when 
					permanent = 'N' then NOW() between validity_from AND Validity_To  else  NOW() >= Publish_Date end"                    ;
        }
        else if (ne.Validity_status == "E")
        {
            //where += @" and (nb.permanent='N' and Date_Format(NOW(),'%d/%m/%Y') > Date_Format(Validity_To,'%d/%m/%Y'))";

            where += @" and nb.permanent='N' and NOW() > Validity_To";
        }


        if (ne.Fromto_status == "YY")
        {
            where += " and validity_from>=@Validity_From and validity_to<=@Validity_To ";
        }
        else
        {
        }

        if (ne.Fromto_status == "Y")
        {
            where += " and validity_from>=@Validity_From ";
        }
        else
        {
        }

        where += " order by publish_date DESC";

        query += where;

        dts = db.executeSelectQuery(query, param);
        return(dts);
    }
コード例 #20
0
    public ReturnClass.ReturnBool update_notice(Notice_Entry ne)
    {
        ReturnClass.ReturnBool rb = new ReturnClass.ReturnBool();
        db_maria_connection    db = new db_maria_connection();

        //BA_layer ba = new BA_layer();

        MySqlParameter[] param = new MySqlParameter[] {
            new MySqlParameter("Header", ne.Header),
            new MySqlParameter("Pernament", ne.Permanent),
            new MySqlParameter("Publish_Date", ne.Publish_date),
            new MySqlParameter("Validity_From", ne.Datefrom),
            new MySqlParameter("Validity_To", ne.Dateto),
            new MySqlParameter("Active", ne.Active),
            new MySqlParameter("Hyperlink", ne.Hyperlink),
            new MySqlParameter("File_Type", ne.Filetype),
            new MySqlParameter("File_Id", ne.file_ID),
            new MySqlParameter("Url", ne.Url),
            new MySqlParameter("Client_Ip", ne.Client_ip),
            new MySqlParameter("User_Id", ne.User_id),
            new MySqlParameter("Date_Time", ne.Datetime),
            new MySqlParameter("Notice_Id", ne.NoticeID),

            new MySqlParameter("bold", ne.Bold),
            new MySqlParameter("blink", ne.Blink),
            new MySqlParameter("priority", ne.Priority),
            new MySqlParameter("color", ne.Color),
            new MySqlParameter("image", ne.Image),
            new MySqlParameter("district_id", ne.District_id),
            new MySqlParameter("dept_id", ne.Base_dept_id),
            new MySqlParameter("ofc_id", ne.Office_id)
        };

        try
        {
            using (TransactionScope ts = new TransactionScope())
            {
                string qur = "insert into notice_board_log select * from Notice_Board where Notice_Id=@Notice_Id";
                rb = db.executeInsertQuery(qur, param);
                if (rb.status == true)
                {
                    string upqur = "update notice_board set Header=@Header,Permanent=@Pernament,Publish_Date=@Publish_Date,Validity_From=@Validity_From, "
                                   + " Validity_To=@Validity_To,Active=@Active,Hyperlink=@Hyperlink,File_Type=@File_Type, "
                                   + " Url=@Url,Client_Ip=@Client_Ip,User_Id=@User_Id,Date_Time=@Date_Time,bold=@bold,blink=@blink,priority=@priority,color=@color,image=@image,File_Id=@File_Id , "
                                   + " district_id=@district_id, base_dept_id=@dept_id, office_id=@ofc_id "
                                   + " where Notice_Id=@Notice_Id ";
                    rb = db.executeUpdateQuery(upqur, param);
                }
                if (rb.status == true)
                {
                    ts.Complete();
                }
            }
        }
        catch (Exception ex)
        {
            rb.status = false;
            Gen_Error_Rpt.Write_Error("Notice Edit Form - Update Method() :- " + ex.Message.ToString());
        }

        return(rb);
    }