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(); }
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"); }