Beispiel #1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        CheckBoxList3.Focus();
        CheckBoxList2.Items.Clear();
        CheckBoxList3.Items.Clear();

        // show Question Button

        for (int i = 0; i < CheckBoxList1.Items.Count; i++)
        {
            if (CheckBoxList1.Items[i].Selected == true)
            {  // fetch question with dropdwn condition
                SqlCommand Ques_cmd = new SqlCommand();
                Ques_cmd.CommandText = "SELECT Question_Id, Question_Details FROM question_bank WHERE Subject_Id =" + DropDownList2.SelectedValue + " AND Chapter_Id =" + CheckBoxList1.Items[i].Value + " AND Minimum_Marks=" + DropDownList3.SelectedValue;
                Ques_cmd.Connection  = cn;
                SqlDataReader dr = Ques_cmd.ExecuteReader();
                // here we assign checkbox2 to question and checkbox3 assign id of question
                while (dr.Read())
                {
                    CheckBoxList2.Items.Add(Convert.ToString(dr.GetValue(1)));
                    CheckBoxList3.Items.Add(Convert.ToString(dr.GetValue(0)));
                }
                dr.Close();
            }
        }

        CheckBoxList2.Focus();
    }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var makes = new List <string> {
                "Ação", "Animação", "Comédia", "Corridas", "Erótico", "Aventura", "Documentário", "Drama"
                , "Fantasia", "Ficção", "Guerra", "Musical", "Policial", "Religioso", "Romance", "Terror"
            };


            var ator = new List <string> {
                "Al Pacino ", "Jack Nicholson", "Chiwetel Ejiofor", "Amanda Peet", "Woody Harrelson", "Morgan Freeman",
                "Brad Pitt", "Angelina Jolie", "Benedict Cumberbatch", "Salvador Dalí", "Al Dalí", "Miranda Cosgrove", "Rik Mayall", "Jimmy Fallon"
            };

            var escritor = new List <string> {
                "Roland Emmerich", "Harald Kloser", "Chiwetel Ejiofor", "Amanda Peet", "Arthur C. Clarke ", " Peter Hyams", "Benedict Cumberbatch", "Salvador Dalí",
            };

            var song = new List <string> {
                "The impact ", "Ashes in D.C", "Singin' in the Rain", "Skyfall", "Born to Be Wild"
            };


            var directores = new List <string> {
                "Ingmar Bergman", "Benedict Cumberbatch", "Chiwetel Ejiofor", "Amanda Peet", "Salvador Dalí", "Federico Fellini", "Francis Ford Coppola", "Charles Chaplin", "Tim Burton", "Roman Polanski", "Roland Emmerich "
            };



            makes.Sort();
            ator.Sort();
            escritor.Sort();
            song.Sort();
            directores.Sort();

            CheckBoxList2.DataSource = escritor;
            CheckBoxList2.DataBind();
            cblEmployees.DataSource = ator;
            cblEmployees.DataBind();
            cblEmployees.DataSource = directores;

            DropDownList1.DataBind();

            for (int i = 1889; i < 2016; i++)
            {
                DropDownList3.Items.Add(i.ToString());
            }



            CheckBoxList3.DataSource = song;
            CheckBoxList3.DataBind();



            DropDownList2.DataSource = makes;
            DropDownList2.DataBind();
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["UserId"] == null)
        {
            Response.Redirect("Welcome.aspx");
        }
        Session.Timeout        = 120;
        SectionPanel.Visible   = false;
        DistrictPanel.CssClass = "col-lg-12";
        SqlDataReader re = DataConnection.selectQuery("select * from member where memeberid = " + Convert.ToInt32(Session["RCV"]) + " and admin = 'A'");

        if (re.HasRows)
        {
            SectionPanel.Visible   = true;
            DistrictPanel.CssClass = "col-lg-6";
        }
        int           count  = CheckBoxList2.Items.Count;
        SqlDataReader reader = DataConnection.selectQuery("select location,memeberid from member where Department='section'");

        if (reader.HasRows)
        {
            //List<String> lst = new List<string>();
            while (reader.Read())
            {
                ListItem item = new ListItem();
                item.Text     = reader.GetString(0);
                item.Value    = reader.GetInt32(1).ToString();
                item.Selected = false;
                CheckBoxList2.Items.Add(item);
            }
        }
        reader.Close();
        DataConnection.closeConnection();

        //count = CheckBoxList3.Items.Count;
        reader = DataConnection.selectQuery("select location,memeberid from member where Department='dist'");
        if (reader.HasRows)
        {
            //List<String> lst = new List<string>();
            while (reader.Read())
            {
                ListItem item = new ListItem();
                item.Text     = reader.GetString(0);
                item.Value    = reader.GetInt32(1).ToString();
                item.Selected = false;
                CheckBoxList3.Items.Add(item);
            }
        }
        reader.Close();
        DataConnection.closeConnection();

        CheckBoxList2.DataBind();
        CheckBoxList3.DataBind();
    }
    private void LoadPlantName()
    {
        try
        {
            Datechanged();
            String        dbConnStr = ConfigurationManager.ConnectionStrings["AMPSConnectionString"].ConnectionString;
            SqlConnection conn      = null;
            using (conn = new SqlConnection(dbConnStr))
            {
                SqlCommand sqlCmd = new SqlCommand("dbo.[Get_PlantwiseSingleBilldateOverAllDataReport]");
                conn.Open();
                sqlCmd.Connection  = conn;
                sqlCmd.CommandType = CommandType.StoredProcedure;
                sqlCmd.Parameters.AddWithValue("@spccode", Company_code);
                sqlCmd.Parameters.AddWithValue("@spfrmdate", d1.ToString());
                sqlCmd.Parameters.AddWithValue("@sptodate", d2.ToString());
                SqlDataAdapter da = new SqlDataAdapter(sqlCmd);
                da.Fill(ds);

                if (ds != null)
                {
                    CheckBoxList1.DataSource     = ds;
                    CheckBoxList1.DataTextField  = "PlantName";
                    CheckBoxList1.DataValueField = "pcode";
                    CheckBoxList1.DataBind();

                    CheckBoxList2.DataSource     = ds;
                    CheckBoxList2.DataTextField  = "Frmtodate2";
                    CheckBoxList2.DataValueField = "Frmtodate3";
                    CheckBoxList2.DataBind();

                    CheckBoxList3.DataSource     = ds;
                    CheckBoxList3.DataTextField  = "Frmtodate1";
                    CheckBoxList3.DataValueField = "Frmtodate4";
                    CheckBoxList3.DataBind();
                }
                else
                {
                }
            }
        }
        catch (Exception ex)
        {
            Lbl_Errormsg.Visible = true;
            Lbl_Errormsg.Text    = ex.ToString();
        }
    }
        void projectList()
        {
            con.Open();
            DataSet ds = new DataSet();

            SqlDataAdapter adp = new SqlDataAdapter("select * from proTable", con);

            adp.Fill(ds);

            CheckBoxList3.DataSource = ds;

            CheckBoxList3.DataTextField = "ProjectTitle";

            CheckBoxList3.DataBind();

            con.Close();
        }
Beispiel #6
0
        private void BindCheckBoxList3()
        {
            List <TestClass> myList = new List <TestClass>();

            myList.Add(new TestClass("value1", "数据绑定值 1"));
            myList.Add(new TestClass("value2", "数据绑定值 2"));
            myList.Add(new TestClass("value3", "数据绑定值 3"));
            myList.Add(new TestClass("value4", "数据绑定值 4"));
            myList.Add(new TestClass("value5", "数据绑定值 5"));
            myList.Add(new TestClass("value6", "数据绑定值 6"));
            myList.Add(new TestClass("value7", "数据绑定值 7"));
            myList.Add(new TestClass("value8", "数据绑定值 8"));
            myList.Add(new TestClass("value9", "数据绑定值 9"));

            CheckBoxList3.DataTextField  = "Name";
            CheckBoxList3.DataValueField = "Id";
            CheckBoxList3.DataSource     = myList;
            CheckBoxList3.DataBind();

            CheckBoxList3.SelectedValueArray = new string[] { "value1", "value2", "value6", "value7" };
        }
Beispiel #7
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     TextBox1.Enabled      = true;
     TextBox2.Enabled      = true;
     TextBox3.Enabled      = true;
     TextBox4.Enabled      = true;
     TextBox5.Enabled      = true;
     CheckBoxList2.Enabled = true;
     CheckBoxList3.Enabled = true;
     CheckBoxList4.Enabled = true;
     CheckBoxList1.Enabled = true;
     Label1.Text           = null;
     TextBox1.Text         = null;
     TextBox2.Text         = null;
     TextBox3.Text         = null;
     TextBox4.Text         = null;
     TextBox5.Text         = null;
     CheckBoxList2.ClearSelection();
     CheckBoxList3.ClearSelection();
     CheckBoxList4.ClearSelection();
     CheckBoxList1.ClearSelection();
 }
Beispiel #8
0
 private void BindCheckBoxListMaster(int tidd)
 {
     try
     {
         ds = MBLL.GetSubMenuTitleCheckBoxMaster(tidd);
         if (tidd == 1)
         {
             CheckBoxList1.DataSource     = ds;
             CheckBoxList1.DataTextField  = "SubMenuName";
             CheckBoxList1.DataValueField = "SubMenuValue";
             CheckBoxList1.DataBind();
         }
         else if (tidd == 2)
         {
             CheckBoxList2.DataSource     = ds;
             CheckBoxList2.DataTextField  = "SubMenuName";
             CheckBoxList2.DataValueField = "SubMenuValue";
             CheckBoxList2.DataBind();
         }
         else if (tidd == 3)
         {
             CheckBoxList3.DataSource     = ds;
             CheckBoxList3.DataTextField  = "SubMenuName";
             CheckBoxList3.DataValueField = "SubMenuValue";
             CheckBoxList3.DataBind();
         }
         else if (tidd == 4)
         {
             CheckBoxList4.DataSource     = ds;
             CheckBoxList4.DataTextField  = "SubMenuName";
             CheckBoxList4.DataValueField = "SubMenuValue";
             CheckBoxList4.DataBind();
         }
     }
     catch (Exception ex)
     {
         ex.Message.ToString();
     }
 }
Beispiel #9
0
    private void LoadPlantName1()
    {
        try
        {
            DataSet       ds        = new DataSet();
            String        dbConnStr = ConfigurationManager.ConnectionStrings["AMPSConnectionString"].ConnectionString;
            SqlConnection conn      = null;
            using (conn = new SqlConnection(dbConnStr))
            {
                SqlCommand sqlCmd = new SqlCommand("dbo.[GetPaymentAllot_BalanceAmount]");
                conn.Open();
                sqlCmd.Connection  = conn;
                sqlCmd.CommandType = CommandType.StoredProcedure;
                SqlDataAdapter da = new SqlDataAdapter(sqlCmd);
                da.Fill(ds);
                if (ds != null)
                {
                    CheckBoxList1.DataSource     = ds;
                    CheckBoxList1.DataTextField  = "Plant";
                    CheckBoxList1.DataValueField = "Plant";//ROUTE_ID
                    CheckBoxList1.DataBind();

                    CheckBoxList2.DataSource     = ds;
                    CheckBoxList2.DataTextField  = "BalanceAmount";
                    CheckBoxList2.DataValueField = "BalanceAmount";//ROUTE_ID
                    CheckBoxList2.DataBind();

                    CheckBoxList3.DataSource     = ds;
                    CheckBoxList3.DataTextField  = "Billdate";
                    CheckBoxList3.DataValueField = "Billdate";//ROUTE_ID
                    CheckBoxList3.DataBind();
                }
            }
        }

        catch (Exception ex)
        {
        }
    }
    private void BindprocurementRemarksData()
    {
        try
        {
            DateTime dt1 = new DateTime();
            dt1 = DateTime.ParseExact(txt_RemmarksDate.Text, "dd/MM/yyyy", null);

            if (rd_sesAm.Checked == true)
            {
                ses = "AM";
            }
            else
            {
                ses = "PM";
            }
            string d1 = dt1.ToString("MM/dd/yyyy");
            ds = Bllproimp.LoadProocurementRemarksDatas(ccode, pcode, d1, ses, IncdecFlag);
            if (ds != null)
            {
                CheckBoxList_Sno.DataSource     = ds;
                CheckBoxList_Sno.DataTextField  = "serial_no";
                CheckBoxList_Sno.DataValueField = "serial_no";
                CheckBoxList_Sno.DataBind();

                CheckBoxList1.DataSource     = ds;
                CheckBoxList1.DataTextField  = "SampleId";
                CheckBoxList1.DataValueField = "SampleId";
                CheckBoxList1.DataBind();

                CheckBoxList2.DataSource     = ds;
                CheckBoxList2.DataTextField  = "agent_Id";
                CheckBoxList2.DataValueField = "agent_Id";
                CheckBoxList2.DataBind();

                CheckBoxList3.DataSource     = ds;
                CheckBoxList3.DataTextField  = "milk_Kg";
                CheckBoxList3.DataValueField = "milk_Kg";
                CheckBoxList3.DataBind();

                CheckBoxList4.DataSource     = ds;
                CheckBoxList4.DataTextField  = "fat";
                CheckBoxList4.DataValueField = "fat";
                CheckBoxList4.DataBind();

                CheckBoxList5.DataSource     = ds;
                CheckBoxList5.DataTextField  = "snf";
                CheckBoxList5.DataValueField = "snf";
                CheckBoxList5.DataBind();

                CheckBoxList6.DataSource     = ds;
                CheckBoxList6.DataTextField  = "magent_Id";
                CheckBoxList6.DataValueField = "magent_Id";
                CheckBoxList6.DataBind();

                CheckBoxList7.DataSource     = ds;
                CheckBoxList7.DataTextField  = "mmilk_Kg";
                CheckBoxList7.DataValueField = "mmilk_Kg";
                CheckBoxList7.DataBind();

                CheckBoxList8.DataSource     = ds;
                CheckBoxList8.DataTextField  = "mfat";
                CheckBoxList8.DataValueField = "mfat";
                CheckBoxList8.DataBind();

                CheckBoxList9.DataSource     = ds;
                CheckBoxList9.DataTextField  = "msnf";
                CheckBoxList9.DataValueField = "msnf";
                CheckBoxList9.DataBind();
            }
            //Adding color to differenciate the remarks modifications Start
            SetColorRemarksData();
            //Adding color to differenciate the remarks modifications End
        }
        catch (Exception ex)
        {
        }
        CheckBoxListClear1();
    }
Beispiel #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.Cookies["admin"] == null || string.IsNullOrEmpty(Request.Cookies["admin"].Value))
        {
            Response.Write("<script>top.location.href='default.aspx';</script>");
            Response.End();
        }
        //string table = "testNews";
        //string id = "1";

        string table = Request.QueryString["t"];
        string id    = Request.QueryString["id"];
        string p     = Request.QueryString["p"];
        //string s = Request.QueryString["s"];
        string m = Request.QueryString["m"];
        Table  t = new Table(table);

        if (string.IsNullOrEmpty(m))
        {
            m = table;
        }

        this.tableName.Value = table;
        this.thisID.Value    = id;

        if (!IsPostBack)
        {
            /*地区选择*/
            if (isRoleTable(table))
            {
                /*string[] areaids = { }, areaid = { };
                 * if (id != null)
                 * {
                 *  DataTable dt = DBFactory.GetConn().exeTable("select top 1 [area] from [" + table + "] where [id]=" + id);
                 *  areaids = dt.Rows[0][0].ToString().Split('|');
                 * }
                 *
                 * CheckBoxList1.DataSource = DBFactory.GetConn().exeTable("select [id],[typename] from [countryType] where [pid]=0 order by [orderid]");
                 * CheckBoxList1.DataTextField = "typename";
                 * CheckBoxList1.DataValueField = "id";
                 * CheckBoxList1.DataBind();
                 *
                 * try
                 * {
                 *  if (areaids.Length >= 1 && areaids[0] != null)
                 *  {
                 *      areaid = areaids[0].Split(',');
                 *      for (int i = 0; i < areaid.Length; i++)
                 *      {
                 *          if (areaid[i] != "" && areaid[i] != ",") CheckBoxList1.Items.FindByValue(areaid[i]).Selected = true;
                 *      }
                 *  }
                 * }
                 * catch { }
                 *
                 * CheckBoxList2.DataSource = DBFactory.GetConn().exeTable("select [id],[typename] from [countryType]  where [pid]<>0 order by [orderid]");
                 * CheckBoxList2.DataTextField = "typename";
                 * CheckBoxList2.DataValueField = "id";
                 * CheckBoxList2.DataBind();
                 *
                 * try
                 * {
                 *  if (areaids.Length >= 2 && areaids[1] != null)
                 *  {
                 *      areaid = areaids[1].Split(',');
                 *      for (int i = 0; i < areaid.Length; i++)
                 *      {
                 *          if (areaid[i] != "" && areaid[i] != ",") CheckBoxList2.Items.FindByValue(areaid[i]).Selected = true;
                 *      }
                 *  }
                 * }
                 * catch { }*/

                string[] areaids = { };
                if (id != null)
                {
                    DataTable dt = DBFactory.GetConn().exeTable("select top 1 [area] from [" + table + "] where [id]=" + id);
                    areaids = dt.Rows[0][0].ToString().Split(',');
                }

                CheckBoxList3.DataSource     = DBFactory.GetConn().exeTable("select [id],[title] from [country] order by [orderid] desc");
                CheckBoxList3.DataTextField  = "title";
                CheckBoxList3.DataValueField = "id";
                CheckBoxList3.DataBind();

                try
                {
                    for (int i = 0; i < areaids.Length; i++)
                    {
                        if (areaids[i] != "" && areaids[i] != ",")
                        {
                            CheckBoxList3.Items.FindByValue(areaids[i]).Selected = true;
                        }
                    }
                }
                catch { }

                /*DropDownList1.DataSource = DBFactory.GetConn().exeTable("select [id],[typename] from [countryType] where [pid]=0 order by [orderid]");
                 * DropDownList1.DataTextField = "typename";
                 * DropDownList1.DataValueField = "id";
                 * DropDownList1.DataBind();
                 *
                 * try
                 * {
                 *  if (areaid.Length >= 1 && areaid[0] != null && areaid[1] != "")
                 *      DropDownList1.Items.FindByValue(areaid[0]).Selected = true;//1
                 * }
                 * catch { }
                 *
                 * DropDownList2.DataSource = DBFactory.GetConn().exeTable("select [id],[typename] from [countryType] where [pid]=" + DropDownList1.SelectedValue.ToString() + " order by [orderid]");
                 * DropDownList2.DataTextField = "typename";
                 * DropDownList2.DataValueField = "id";
                 * DropDownList2.DataBind();
                 *
                 * try
                 * {
                 *  if (areaid.Length >= 2 && areaid[1] != null && areaid[1] != "")
                 *      DropDownList2.Items.FindByValue(areaid[1]).Selected = true;//2
                 * }
                 * catch { }
                 *
                 * DropDownList3.DataSource = DBFactory.GetConn().exeTable("select [id],[title] from [country] where [typeid]=" + DropDownList2.SelectedValue.ToString() + " order by [orderid] desc");
                 * DropDownList3.DataTextField = "title";
                 * DropDownList3.DataValueField = "id";
                 * DropDownList3.DataBind();
                 *
                 * try
                 * {
                 *  if (areaid.Length >= 3 && areaid[2] != null && areaid[1] != "")
                 *      DropDownList3.Items.FindByValue(areaid[2]).Selected = true;//3
                 * }
                 * catch { }*/
            }
            /*地区选择*/
        }

        if (Request.QueryString["f"] != null && !string.IsNullOrEmpty(Request.QueryString["f"]))
        {
            this.Literal2.Text = "分类";
        }
        else
        {
            this.Literal2.Text = "信息";
        }

        if (Request.QueryString["type"] != null && Request.QueryString["type"] == "add")
        {
            this.Literal2.Text += "添加";
        }
        else
        {
            this.Literal2.Text += "修改";
        }


        UIHelper.SetupPanel(table, this.main, this, id, false);

        if (!string.IsNullOrEmpty(p))
        {
            this.addlink.NavigateUrl = "edit.aspx?t=" + table + "&type=add&p=" + p + "&m=" + m;
        }
        else
        {
            this.addlink.Visible = false;
        }
        if (!string.IsNullOrEmpty(m) && (m != table))
        {
            this.menulink.NavigateUrl = "menu.aspx?mt=" + m + "&ct=" + table;
        }
        else
        {
            this.menulink.Visible = false;
        }

        if ((!string.IsNullOrEmpty(m)) && (new Table(m)).AddChildDepth != 0)
        {
            this.addmenulink.NavigateUrl = "edit.aspx?id=0&type=add&f=menu&t=" + m;
        }
        else
        {
            this.addmenulink.Visible = false;
        }

        if (t.IsSingle)
        {
            this.listlink.Visible     = false;
            this.Literal3.Visible     = false;
            this.searchKey.Visible    = false;
            this.ImageButton1.Visible = false;
        }
        else
        {
            this.listlink.NavigateUrl = "list.aspx?t=" + table + "&m=" + m + "&p=" + p;
        }

        int pid = 0;

        try
        {
            pid = int.Parse(p);
        }
        catch (Exception ex)
        { }
        try
        {
            this.Literal1.Text = UIHelper.Location(m, pid);
        }
        catch (Exception ex)
        { }
        this.Literal1.Text += " → " + this.Literal2.Text;
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string message  = "";
        string memberno = "";

        CheckBoxList2.DataBind();
        CheckBoxList3.DataBind();
        CheckBoxList4.DataBind();
        CheckBoxList5.DataBind();
        CheckBoxList6.DataBind();

        if (Session["sgques"].ToString() == "SendData")
        {
            DataConnection.insertQuery("update message set sgsubmit='T' where QNO=N'" + Session["quesno"].ToString() + "' and Assemblys=N'" + Session["sadan"].ToString() + "' and Session=N'" + Session["session"].ToString() + "'");
            DataConnection.insertQuery("insert into miscellenous (other_posist_name,posist_no,posist_date,answer_mem_name,ans_no,ans_date,remark,session,assemblys,quesno) values('" + TextBox8.Text + "','" + TextBox9.Text + "','" + Convert.ToDateTime(TextBox10.Text) + "','" + TextBox11.Text + "','" + TextBox12.Text + "','" + Convert.ToDateTime(TextBox13.Text) + "','" + TextBox14.Text + "','" + Session["session"].ToString() + "','" + Session["sadan"] + "'," + Convert.ToInt32(Session["quesno"].ToString()) + ")");

            Response.Redirect("Dashboard.aspx");
        }
        else
        {
            if (getCheckBoxCount(CheckBoxList2) > 0)
            {
                for (int i = 0; i < CheckBoxList2.Items.Count; i++)
                {
                    if (CheckBoxList2.Items[i].Selected)
                    {
                        SqlDataReader r1 = DataConnection.selectQuery("select memeberid from member where member_name=N'" + CheckBoxList2.Items[i].Text.Trim() + "'");
                        if (r1.HasRows)
                        {
                            while (r1.Read())
                            {
                                memberno = r1.GetInt32(0).ToString();
                            }
                        }
                        r1.Close();

                        DataConnection.insertQuery("insert into message(QNO,RCV,Sender,Assemblys,Session) values(N'" + Session["quesno"].ToString() + "',N'" + memberno + "',N'" + Session["RCV"].ToString() + "',N'" + Session["assembly"].ToString() + "',N'" + Session["Session"].ToString() + "')");
                    }
                }
            }

            if (getCheckBoxCount(CheckBoxList3) > 0)
            {
                for (int i = 0; i < CheckBoxList3.Items.Count; i++)
                {
                    if (CheckBoxList3.Items[i].Selected)
                    {
                        SqlDataReader r = DataConnection.selectQuery("select memeberid from member where location=N'" + CheckBoxList3.Items[i].Text.Trim() + "'");
                        if (r.HasRows)
                        {
                            while (r.Read())
                            {
                                memberno = r.GetInt32(0).ToString();
                            }
                        }
                        r.Close();

                        DataConnection.insertQuery("insert into message(QNO,RCV,Sender,Assemblys,Session) values(N'" + Session["quesno"].ToString() + "',N'" + memberno + "',N'" + Session["RCV"].ToString() + "',N'" + Session["assembly"].ToString() + "',N'" + Session["Session"].ToString() + "')");
                    }
                }
            }

            if (getCheckBoxCount(CheckBoxList4) > 0)
            {
                for (int i = 0; i < CheckBoxList4.Items.Count; i++)
                {
                    if (CheckBoxList4.Items[i].Selected)
                    {
                        SqlDataReader re = DataConnection.selectQuery("select memeberid from member where location=N'" + CheckBoxList4.Items[i].Text.Trim() + "'");
                        if (re.HasRows)
                        {
                            while (re.Read())
                            {
                                memberno = re.GetInt32(0).ToString();
                            }
                            re.Close();
                            DataConnection.insertQuery("insert into message(QNO,RCV,Sender,Assemblys,Session) values(N'" + Session["quesno"].ToString() + "',N'" + memberno + "',N'" + Session["RCV"].ToString() + "',N'" + Session["assembly"].ToString() + "',N'" + Session["Session"].ToString() + "')");
                        }
                    }
                }
            }

            if (getCheckBoxCount(CheckBoxList5) > 0)
            {
                for (int i = 0; i < CheckBoxList5.Items.Count; i++)
                {
                    if (CheckBoxList5.Items[i].Selected)
                    {
                        SqlDataReader re2 = DataConnection.selectQuery("select memeberid from member where location=N'" + CheckBoxList5.Items[i].Text.Trim() + "'");
                        if (re2.HasRows)
                        {
                            while (re2.Read())
                            {
                                memberno = re2.GetInt32(0).ToString();
                            }
                            re2.Close();
                            DataConnection.insertQuery("insert into message(QNO,RCV,Sender,Assemblys,Session) values(N'" + Session["quesno"].ToString() + "',N'" + memberno + "',N'" + Session["RCV"].ToString() + "',N'" + Session["assembly"].ToString() + "',N'" + Session["Session"].ToString() + "')");
                        }
                    }
                }
            }


            if (getCheckBoxCount(CheckBoxList6) > 0)
            {
                for (int i = 0; i < CheckBoxList6.Items.Count; i++)
                {
                    if (CheckBoxList6.Items[i].Selected)
                    {
                        SqlDataReader re3 = DataConnection.selectQuery("select memeberid from member where location=N'" + CheckBoxList6.Items[i].Text.Trim() + "'");
                        if (re3.HasRows)
                        {
                            while (re3.Read())
                            {
                                memberno = re3.GetInt32(0).ToString();
                            }
                            re3.Close();
                            DataConnection.insertQuery("insert into message(QNO,RCV,Sender,Assemblys,Session) values(N'" + Session["quesno"].ToString() + "',N'" + memberno + "',N'" + Session["RCV"].ToString() + "',N'" + Session["assembly"].ToString() + "',N'" + Session["Session"].ToString() + "')");
                        }
                    }
                }
            }


            if (getCheckBoxCount(CheckBoxList2) < 0)
            {
                message = "Select Atleast Section ";
                ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "alert('" + message + "');", true);
                return;
            }
        }
        message = "Data has Stored Successfully";
        ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "alert('" + message + "');", true);
        Response.Redirect("Dashboard.aspx");
    }
Beispiel #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            List <string> cities = new List <string>();

            cities.Add("Gilgit");
            cities.Add("Chitral");
            cities.Add("Dasu");
            cities.Add("Dir");
            cities.Add("Malakand");
            cities.Add("Noshera");
            cities.Add("Mansehra");
            cities.Add("Hassan Abdal");
            cities.Add("Peshawar");
            cities.Add("Attock");
            cities.Add("Kohat");
            cities.Add("Islamabad");
            cities.Add("Murree");
            cities.Add("Rawat");
            cities.Add("Balkasar");
            cities.Add("Chakwal");
            cities.Add("Mianwali");
            cities.Add("Bhera");
            cities.Add("Sargoda");
            cities.Add("Pindi Bhattian");
            cities.Add("Jhang");
            cities.Add("Faisalabad");
            cities.Add("Lahore");
            cities.Add("Dina");
            cities.Add("Gujranwala");
            cities.Add("Multan");
            cities.Add("DG Khan");
            cities.Add("Bahwalpur");
            cities.Add("Sukkur");
            cities.Add("Rajanpur");
            cities.Add("Loralai");
            cities.Add("Jacobabad");
            cities.Add("Quetta");
            cities.Add("Khuzdar");
            cities.Add("Karachi");
            cities.Add("Lasbela");
            cities.Add("Gwadar");
            cities.Add("Awaran");
            cities.Add("Turbat");



            if (!IsPostBack)
            {
                CheckBoxList1.DataSource = cities;
                CheckBoxList2.DataSource = cities;
                CheckBoxList3.DataSource = cities;
                CheckBoxList1.DataBind();
                CheckBoxList2.DataBind();
                CheckBoxList3.DataBind();
            }
            GridView1.DataSource = ExcelToDS().Tables[0];
            GridView1.DataBind();

            loadData();
            int[,] prep2 = new int[39, 39];
            int[,] D1    = resetMatrix(mygraph.vedges);
            for (int i = 0; i < 39; i++)
            {
                for (int j = 0; j < 39; j++)
                {
                    prep2[i, j] = D1[i, j];
                }
            }
            //   int[,] prevD = resetMatrix2(mygraph.vedges);
            int [,] Dp = Floyd(D1, 39);

            //========================================================================//

            Prims            obj     = new Prims();
            List <totaledgs> newlist = obj.primMST(mygraph.vedges);

            ListBox7.DataSource    = newlist;
            ListBox8.DataSource    = newlist;
            ListBox9.DataSource    = newlist;
            Label2.Text            = newlist[1].Weight.ToString();
            ListBox7.DataTextField = "src";
            ListBox7.DataBind();
            ListBox8.DataTextField = "dst";
            ListBox8.DataBind();
            ListBox9.DataTextField = "weight";
            ListBox9.DataBind();
        }
Beispiel #14
0
    /*void saveToPdf(string base64Str, string filePath, string file)
     * {
     *  byte[] bytes = Convert.FromBase64String(base64Str);
     *  //string filename = file + ".pdf";
     *  //string filename = CheckBoxList1.SelectedItem.ToString();
     *  //string filepath = CheckBoxList1.SelectedValue;
     *
     *  //System.IO.FileStream stream = new FileStream(filePath + filename, FileMode.CreateNew);
     * // System.IO.BinaryWriter writer = new BinaryWriter(stream);
     *  //writer.Write(bytes, 0, bytes.Length);
     *  //writer.Close();
     * }*/

    #region Send Message New Business/ Cover Note
    //send message button for new business
    protected void Button7_Click(object sender, EventArgs e)
    {
        MemoryStream ms1 = new MemoryStream();

        try
        {
            MailMessage msg = new MailMessage();
            msg.From = new MailAddress("*****@*****.**", "Coverinaclick.ie", System.Text.Encoding.UTF8);
            msg.To.Add(to_email.Text);
            msg.Subject         = subject.Text;
            msg.SubjectEncoding = System.Text.Encoding.UTF8;
            //msg.Body = message_area.Value;
            msg.BodyEncoding = System.Text.Encoding.UTF8;
            msg.IsBodyHtml   = true;
            var application = new Microsoft.Office.Interop.Word.Application();
            var document    = new Microsoft.Office.Interop.Word.Document();


            document = application.Documents.Add(Template: @"c:\Projects\CoverNote.docx");
            //application.Visible = true;

            foreach (Microsoft.Office.Interop.Word.Field field in document.Fields)
            {
                if (field.Code.Text.Contains("FirstName"))
                {
                    field.Select();
                    application.Selection.TypeText(fullname_txtbox.Text);
                }
                else if (field.Code.Text.Contains("date"))
                {
                    field.Select();
                    application.Selection.TypeText(TextBox2.Text);
                }
                else if (field.Code.Text.Contains("InsuranceCoy"))
                {
                    field.Select();
                    application.Selection.TypeText("Axa");
                }
                else if (field.Code.Text.Contains("benefits"))
                {
                    field.Select();
                    List <String> CheckBoxListStr1 = new List <string>();
                    foreach (ListItem item1 in CheckBoxList3.Items)
                    {
                        if (item1.Selected)
                        {
                            CheckBoxListStr1.Add(item1.Value);
                        }
                    }

                    String checkList1 = String.Join(" ", CheckBoxListStr1.ToArray());
                    application.Selection.TypeText(checkList1);
                }
                else if (field.Code.Text.Contains("docs"))
                {
                    field.Select();
                    List <String> CheckBoxListStr = new List <string>();
                    foreach (ListItem item in CheckBoxList2.Items)
                    {
                        if (item.Selected)
                        {
                            CheckBoxListStr.Add(item.Value);
                        }
                    }

                    String checkList = String.Join(Environment.NewLine, CheckBoxListStr.ToArray());
                    application.Selection.TypeText(checkList);
                }
            }
            DateTime add_Months = Convert.ToDateTime(TextBox2.Text).AddDays(365);
            TextBox3.Text = add_Months.ToString();

            var x = double.Parse(gross_amt.Text);
            var y = double.Parse(chrg.Text);
            var z = x + y;

            List <String> checkbxlst = new List <string>();
            foreach (ListItem item in CheckBoxList3.Items)
            {
                if (item.Selected)
                {
                    checkbxlst.Add(item.Value);
                }
            }
            string theList = String.Join(",", checkbxlst.ToArray());

            List <String> checkbxlst1 = new List <string>();
            foreach (ListItem item in CheckBoxList2.Items)
            {
                if (item.Selected)
                {
                    checkbxlst1.Add(item.Value);
                }
            }
            string theList1 = String.Join(",", checkbxlst1.ToArray());

            //msg.Body = document.Content.Text;
            msg.Body = "<p>Dear " + fullname_txtbox.Text + ", </p>" + "<p> Thank you for your new business instruction, we have incepted cover from " + TextBox2.Text + ". </p>" +
                       "\n" + "<p> Find attached proposal form/statement of fact, which contains the information on which we have provided the quotation and incepted cover. Ensure that you read the proposal form/statement of fact to ensure all risk details are correct. If any of the details are not accurate to the acceptance and assessment of the risk, then please provide full details immediately. </p>"
                       + "<p> Your policy would include: </p>" + "&#8594 " + theList
                       + "<p> The proposal form/statement of fact will form part of the contract between you and your insurance company. </p>"
                       + "<p> Please forward the following documents within 7 days:  </p>" + "&#8594" + theList1
                       + "\n" + "<p>Thank you </p>" + "\n----------------" + "<br />" + "coverinaclick.ie"
                       + "<br />Insurance House"
                       + "<br />" + "62A Terenure Road North"
                       + "<br />" + "Terenure"
                       + "<br />" + "Dublin 6W"
                       + "<p><a href = www.insuremyvan.ie><img src = imv.jpg alt = IMV_LOGO></a>"
                       + "<a href = www.coverinaclick.ie><img src = ciac.jpg alt = CIAC_LOGO></a>"
                       + "<a href = www.insuremyhouse.ie><img src = imh.jpg alt = IMH_LOGO></a></p>"

                       /*+ "<p> --------------------------------------------------------------------------------------------"
                        + "<br />" + "-------------------------------------------------------------------------------------------"
                        + "<br />" + " &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp<strong> INVOICE </strong>"
                        + "<br />" + "Should you wish to make any further alterations to your policy, please advise us, and any adjustments will be dealt with when completed."
                        + "\n" + "<table border = 1 style = width:100%> <tr> <td> Period of cover: &nbsp &nbsp &nbsp" + TextBox2.Text + " " + "to" + " " + TextBox3.Text
                        + "<p> Premium:  &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp" + "€" + gross_amt.Text + "</p>"
                        + "<p>Administration charge: &nbsp &nbsp &nbsp &nbsp  " + "€" + chrg.Text + "</p>"
                        + "<p><strong> TOTAL PREMIUM: &nbsp &nbsp &nbsp &nbsp </strong>" + "€" + z + "</p></td></tr></table>"*/
                       + "<p><strong> SPECIAL NOTICE - DUTY OF DISCLOSURE</strong> </P>"
                       + "\n" + "<ol>" + "<li> Duty of Disclosure: Any facts known to you, and any changes affecting the risk since inception of the policy or last renewal date (whichever is the later) must be disclosed to us. Failure to disclose may mean that your policy may not provide you with the cover you require, or may invalidate the policy altogether.</li>"
                       + "<li> The amount shown includes a 5% Government levy and an Administration Charge (1989 Insurance Act of Practice)</li>" + "</ol>"
                       + "<p><font color = blue> City Financial Marketing Group Ltd is regulated by the Central Bank of Ireland</p>"
                       + "<p>City Financial Marketing is a memeber of the Irish Brokers Association</p>"
                       + "<p>City Financial Marketing Group Ltd is a company registered in Ireland. Registered office is situated at 70 Northumberland Road, Ballsbridge, Dublin 4, Registered Number 235088.</p>"
                       + "<p>This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the sender. Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of the CFM Group. Finally, whilst every effort has been made to ensure this e-mail and any attachments are virus free CFM Group Ltd accepts no liability for any damage caused should any viruses be transmitted by this email.</p>"
                       + "\nPlease consider the environment before printing this email.</font>";



            using (System.IO.MemoryStream ms = new MemoryStream())
            {
                using (System.IO.StreamWriter writer = new StreamWriter(ms))
                {
                    writer.Write("Hello");
                    writer.Flush();
                    //writer.Dispose();

                    System.Net.Mime.ContentType ct        = new System.Net.Mime.ContentType(System.Net.Mime.MediaTypeNames.Application.Pdf);
                    System.Net.Mail.Attachment  attchFile = new Attachment(ms, ct);
                    //attchFile.ContentStream.
                    attchFile.ContentDisposition.FileName = "Terms of Business.pdf";
                    msg.Attachments.Add(attchFile);
                    if (FileUpload3.HasFile)
                    {
                        Attachment attachment;
                        attachment = (new Attachment(FileUpload3.PostedFile.InputStream, FileUpload3.FileName));
                        attachment.ContentDisposition.FileName = "Your Policy Booklet.pdf";
                        msg.Attachments.Add(attachment);
                    }
                    if (FileUpload4.HasFile)
                    {
                        Attachment attachment1;
                        attachment1 = (new Attachment(FileUpload4.PostedFile.InputStream, FileUpload4.FileName));
                        attachment1.ContentDisposition.FileName = "Proposal Form " + "/" + "Statement of Fact.pdf";
                        msg.Attachments.Add(attachment1);
                    }
                    if (FileUpload5.HasFile)
                    {
                        //Directory.CreateDirectory(@"");
                        Attachment attachment2;
                        attachment2 = (new Attachment(FileUpload5.PostedFile.InputStream, FileUpload5.FileName));
                        attachment2.ContentDisposition.FileName = "Direct Debit Mandate.pdf";
                        msg.Attachments.Add(attachment2);
                    }
                    if (FileUpload6.HasFile)
                    {
                        //Directory.CreateDirectory(@"");
                        Attachment attachment3;
                        attachment3 = (new Attachment(FileUpload6.PostedFile.InputStream, FileUpload6.FileName));
                        attachment3.ContentDisposition.FileName = "Gap in Cover";
                        msg.Attachments.Add(attachment3);
                    }
                    if (FileUpload7.HasFile)
                    {
                        //Directory.CreateDirectory(@"");
                        Attachment attachment4;
                        attachment4 = (new Attachment(FileUpload7.PostedFile.InputStream, FileUpload7.FileName));
                        attachment4.ContentDisposition.FileName = "Sold Car Declaration";
                        msg.Attachments.Add(attachment4);
                    }
                    if (FileUpload8.HasFile)
                    {
                        //Directory.CreateDirectory(@"");
                        Attachment attachment5;
                        attachment5 = (new Attachment(FileUpload8.PostedFile.InputStream, FileUpload8.FileName));
                        attachment5.ContentDisposition.FileName = "Surrender of NCB";
                        msg.Attachments.Add(attachment5);
                    }
                    msg.IsBodyHtml = true;

                    SmtpClient smtp = new SmtpClient();
                    smtp.Host = "smtp.gmail.com";
                    System.Net.NetworkCredential netwrkcred = new System.Net.NetworkCredential();
                    netwrkcred.UserName        = "******";
                    netwrkcred.Password        = "******";
                    smtp.UseDefaultCredentials = true;
                    smtp.Credentials           = netwrkcred;
                    smtp.Port      = 587;
                    smtp.EnableSsl = true;
                    smtp.Send(msg);

                    //ms.Close();

                    ShowMessage("Message sent!!");

                    CheckBoxList3.ClearSelection();
                    //RadioButtonList1.ClearSelection();
                    to_email.Text = string.Empty;
                    //message_area.Value = string.Empty;
                    TextBox2.Text        = string.Empty;
                    fullname_txtbox.Text = string.Empty;
                    CheckBoxList2.ClearSelection();
                    gross_amt.Text = string.Empty;
                    chrg.Text      = string.Empty;
                }
            }

            //byte[] pdfByte = System.IO.File.ReadAllBytes(Server.MapPath("~/PDF Document/Timetable(1)"));
            //Attachment attachFile = new Attachment(new MemoryStream(CheckBoxList1.DataValueField), "pdf");
            // msg.Attachments.Add(attachFile);
        }
        catch (Exception ex)
        {
            Response.Write("Error" + ex.ToString());
        }
    }