private void bindDiary() { SqlDataAdapter addiary, addiary1; // B7 addiary = new SqlDataAdapter("select DiaryEntry.DiaryNo,DiaryEntry.Diary,DiaryEntry.Status,DiaryEntry.CourierNo as RefNo,DiaryEntry.IMID as Membership from DiaryEntry where SubmittedTo='Project'and Status='ProReceive' and DiaryNo in (select DairyNo from DairyCount where Department='Project') and ExamSession='" + lblHiddenSeason.Text + "'", con); addiary1 = new SqlDataAdapter("select DiaryEntry.DiaryNo,DiaryEntry.Diary,DiaryEntry.Status,DiaryEntry.CourierNo as RefNo,DiaryEntry.IMID as Membership from DiaryEntry where SubmittedTo='Project'and Status='CountDispatch' and DiaryNo in (select DairyNo from DairyCount where Department='Account') and ExamSession='" + lblHiddenSeason.Text + "'", con); DataTable ds = new DataTable(); addiary.Fill(ds); addiary1.Fill(ds); GridDiaryNo.DataSource = ds; GridDiaryNo.DataBind(); //B6 addiary = new SqlDataAdapter("select DairyNo,Status,IMID from DairyCount where DairyNo IN (select Distinct DiaryNo From DiaryEntry where Status='CountDispatch' and ExamSession='" + lblHiddenSeason.Text.ToString() + "') and Department='Project' order by DairyNo desc", con); DataTable dt = new DataTable(); addiary.Fill(dt); GrdCountDispatch.DataSource = dt; GrdCountDispatch.DataBind(); //B8 addiary = new SqlDataAdapter("select Status,DairyNo,IMID,DDRcv,DDSub,ProformaARcv,ProformaASub,ProformaBRcv,ProformaBSub,CurrentDate from Projectcount where Session='" + lblHiddenSeason.Text + "' and dairyNo in(select DiaryNo from DiaryEntry where SubmittedTo='Project') order by DairyNo desc", con); DataTable dt1 = new DataTable(); addiary.Fill(dt1); GridProject.DataSource = dt1; GridProject.DataBind(); }
protected void txtIDIM_TextChanged(object sender, EventArgs e) { lblException.Text = ""; con.Close(); con.Open(); cmd = new SqlCommand(); SqlTransaction sTR; sTR = con.BeginTransaction(); cmd.Connection = con; cmd.Transaction = sTR; try { int i = 0; cmd.CommandText = "select * from IM where ID='" + txtIDIM.Text.ToString() + "'"; reader = cmd.ExecuteReader(); if (reader.Read()) { lblIMName.Text = reader[1].ToString(); lblIMAddress.Text = reader[3].ToString(); lblIMCity.Text = reader["Address2"].ToString() + ", " + reader[4].ToString() + " ,( " + reader[5].ToString() + " )"; lblEnrolment.Text = reader["ID"].ToString(); lblGroupID.Text = reader["GID"].ToString(); btnSubmitAmt.Enabled = true; pnlIMInfo.Visible = true; i += 1; } else { txtIDIM.Text = "Invalid ID"; lblIMAddress.Text = ""; lblIMName.Text = ""; lblIMCity.Text = "Please Insert Valid IM ID."; pnlIMInfo.Visible = false; txtIDIM.Focus(); } reader.Close(); if (i == 1) { // total(txtIDIM.Text, sTR, cmd); txtACNO.Text = ""; lblexceptionDirary.Text = ""; cmd.CommandText = "select DairyCount.DairyNo,DairyCount.IMID,DiaryEntry.MemberType from DairyCount left outer join DiaryEntry on DairyCount.DairyNo=DiaryEntry.DiaryNo where DairyCount.TotalDDRcv > (DairyCount.TotalDDSub+DairyCount.MemberRcv) and DiaryCount.Session='" + lblhiddenSession.Text + "' and DiaryEntry.IMID='" + txtIDIM.Text + "' order by DairyCount.DairyNo desc"; //cmd.CommandText = "select DiaryNo,MembershipNo,MemberType From DiaryEntry where IMID='" + txtIDIM.Text.ToString() + "' and ExamSession='" + lblhiddenSession.Text.ToString() + "' and Status='Open' order by DiaryNo desc"; reader = cmd.ExecuteReader(); GridDiaryNo.DataSource = reader; GridDiaryNo.DataBind(); reader.Close(); reader.Dispose(); sTR.Commit(); } txtACNO.Focus(); } catch (Exception ex) { sTR.Rollback(); } finally { con.Close(); con.Dispose(); } }
protected void btnSubmit_Click(object sender, EventArgs e) { dtinfo.DateSeparator = "/"; dtinfo.ShortDatePattern = "dd/MM/yyyy"; Projectcls pcl = new Projectcls(); string sts = pcl.CountStatusDairy(txtDiaryNo.Text.ToString(), ddlExamSeason.SelectedValue.ToString() + txtYearSeason.Text); if (sts == "NotSubmitted" && txtDiaryNo.Text != "" && ddlDiaryType.SelectedValue.ToString() != "select") { con.Close(); con.Open(); SqlCommand cmd = new SqlCommand(); cmd = new SqlCommand("update DiaryEntry set Status=@Status,DiaryType=@DiaryType,SubmittedTo=@SubmittedTo,OpenedDate=@OpenedDate where DiaryNo='" + txtDiaryNo.Text.ToString() + "' and ExamSession='" + lblHiddenSeason.Text.ToString() + "'", con); cmd.Parameters.AddWithValue("@Status", "CountDispatch"); cmd.Parameters.AddWithValue("@DiaryType", ddlDiaryType.SelectedValue.ToString()); cmd.Parameters.AddWithValue("@SubmittedTo", ddlSupplyTo.SelectedValue.ToString()); cmd.Parameters.AddWithValue("@OpenedDate", DateTime.Now); cmd.ExecuteNonQuery(); cmd = new SqlCommand("insert into DairyCount(DairyNo,Session,Department,CurrentDate,DairyType,IMID,LatterTo,LatterFrom,Status,TotalDDRcv,TotalNoForm) Values(@DiaryNo,@Session,@Department,@CurrentDate,@DairyType,@IMID,@LatterTo,@LatterFrom,@Status,@TotalDDRcv,@TotalNoForm)", con); cmd.Parameters.AddWithValue("@DiaryNo", txtDiaryNo.Text.ToString()); cmd.Parameters.AddWithValue("@Session", ddlExamSeason.SelectedValue.ToString() + txtYearSeason.Text); cmd.Parameters.AddWithValue("@Department", ddlSupplyTo.SelectedValue.ToString()); cmd.Parameters.AddWithValue("@CurrentDate", DateTime.Now); cmd.Parameters.AddWithValue("@DairyType", ddlDiaryType.SelectedValue.ToString()); cmd.Parameters.AddWithValue("@IMID", lblIMID.Text); cmd.Parameters.AddWithValue("@LatterTo", "N/A"); cmd.Parameters.AddWithValue("@LatterFrom", "N/A"); if (txtDD.Text == "" | txtForms.Text == "") { cmd.Parameters.AddWithValue("@Status", "NotOpen"); } else { cmd.Parameters.AddWithValue("@Status", "Open"); } cmd.Parameters.AddWithValue("@TotalDDRcv", txtDD.Text); cmd.Parameters.AddWithValue("@TotalNoForm", txtForms.Text); cmd.ExecuteNonQuery(); cmd = new SqlCommand("Insert into ProjectCount(DairyNo,Session,IMID,CurrentDate,Status) Values(@DairyNo,@Session,@IMID,@CurrentDate,@Status)", con); cmd.Parameters.AddWithValue("@DairyNo", txtDiaryNo.Text.ToString()); cmd.Parameters.AddWithValue("@Session", lblHiddenSeason.Text.ToString()); cmd.Parameters.AddWithValue("@IMID", lblIMID.Text.ToString()); cmd.Parameters.AddWithValue("@CurrentDate", DateTime.Now); cmd.Parameters.AddWithValue("@Status", "Submitted"); cmd.ExecuteNonQuery(); con.Close(); bindDiary(); con.Dispose(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('Successfully Submitted')", true); txtDD.Text = ""; txtForms.Text = ""; txtDiaryNo.Text = ""; lblIMID.Text = ""; } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('Please insert Correct value')", true); } GridDiaryNo.Focus(); }
private void fillgr() { SqlDataAdapter addiary = new SqlDataAdapter("select DairyNo from DairyCount where MemberRcv>0 and MemberRcv>MemberSub and IMID='" + txtId.Text + "'", con); DataSet ds = new DataSet(); addiary.Fill(ds); if (ds.Tables[0].ToString() != "") { GridDiaryNo.DataSource = ds; GridDiaryNo.DataBind(); } }
private void fillDiary() { SqlDataAdapter addiary = new SqlDataAdapter("select DairyCount.DairyNo,DiaryEntry.IMID,DiaryEntry.MemberType from DairyCount left outer join DiaryEntry on DairyCount.DairyNo=DiaryEntry.DiaryNo where DiaryEntry.ExamSession='" + lblhiddenSession.Text.ToString() + "' and DiaryEntry.Status='Open' and (DairyCount.TotalDDRcv > (DairyCount.TotalDDSub+DairyCount.MemberRcv)) order by DairyCount.DairyNo desc", con); DataSet ds = new DataSet(); addiary.Fill(ds); if (ds.Tables[0].ToString() != "") { GridDiaryNo.DataSource = ds; GridDiaryNo.DataBind(); } }
protected void btnClear_Click(object sender, EventArgs e) { txtDOB.Text = DateTime.Now.ToString("dd/MM/yyyy"); txtDDNO.Text = ""; txtNarration.Text = ""; txtAmt.Text = "0"; ddlCurrancy.SelectedIndex = 0; lblCurrancyText.Visible = false; lblCurrancyName.Visible = false; txtCurrancyValue.Visible = false; txtCurrancyValue.Text = "1"; calculate(txtAmt.Text, txtCurrancyValue.Text); lblException.Text = ""; GridDiaryNo.Focus(); }
private void bindDiary() { SqlDataAdapter addiary = new SqlDataAdapter("select Distinct DiaryNo,Diary,Status,CourierNo as RefNo,MembershipNo as Mem_No From DiaryEntry where (Status='CountReceived' OR Status='CountDispatch') and ExamSession='" + lblHiddenSeason.Text + "' order by Diary desc", con); DataSet ds = new DataSet(); addiary.Fill(ds); GridDiaryNo.DataSource = ds; //B3 GridDiaryNo.DataBind(); SqlDataAdapter countdiary = new SqlDataAdapter("select Distinct DiaryNo,Diary,CourierNo as RefNo,MembershipNo as Mem_No From DiaryEntry where Status='DiaryEntry' and ExamSession='" + lblHiddenSeason.Text + "' order by Diary desc", con); DataSet ds1 = new DataSet(); countdiary.Fill(ds1); GrdCountReceived.DataSource = ds1; //B2 GrdCountReceived.DataBind(); }
private void bindDiary() { SqlDataAdapter addiary = new SqlDataAdapter("select Distinct DiaryNo,Diary From DiaryEntry where Status='Open' and ExamSession='" + lblHiddenSeason.Text.ToString() + "' order by Diary desc", con); DataSet ds = new DataSet(); addiary.Fill(ds); if (ds.Tables[0].ToString() != "") { GridDiaryNo.DataSource = ds; GridDiaryNo.DataBind(); } foreach (GridViewRow rw in GridDiaryNo.Rows) { rw.Cells[2].Visible = false; GridDiaryNo.HeaderRow.Cells[2].Visible = false; } }
private void txtIMID() { con.Close(); con.Open(); SqlCommand cmd = new SqlCommand("select ID from IM where ID='" + txtIDIM.Text.ToString() + "'", con); string chk = Convert.ToString(cmd.ExecuteScalar()); int i = 0; if (chk == txtIDIM.Text.ToString()) { i += 1; } else { txtIDIM.Text = "Invalid ID"; lblIMAddress.Text = ""; lblIMName.Text = ""; lblIMCity.Text = "Please Insert Valid IM ID."; pnlIMInfo.Visible = false; txtIDIM.Focus(); } if (i == 1) { cmd = new SqlCommand("select * from IM where ID='" + txtIDIM.Text.ToString() + "'", con); SqlDataReader reader; reader = cmd.ExecuteReader(); while (reader.Read()) { lblIMName.Text = reader[1].ToString(); lblIMAddress.Text = reader[3].ToString(); lblIMCity.Text = reader["Address2"].ToString() + ", " + reader[4].ToString() + " ,( " + reader[5].ToString() + " )"; lblEnrolment.Text = reader["ID"].ToString(); lblGroupID.Text = reader["GID"].ToString(); pnlIMInfo.Visible = true; } reader.Close(); txtDiaryNo.Text = ""; lblexceptionDirary.Text = ""; SqlDataAdapter addiary = new SqlDataAdapter("select Distinct DiaryNo From DiaryEntry where IMID='" + txtIDIM.Text.ToString() + "' and ExamSession='" + lblhiddenSession.Text.ToString() + "' and Status='Open' order by DiaryNo desc", con); DataSet ds = new DataSet(); addiary.Fill(ds); if (ds.Tables[0].ToString() != "") { GridDiaryNo.DataSource = ds; GridDiaryNo.DataBind(); } txtDiaryNo.Focus(); } con.Close(); }
private void bindDiary() { SqlDataAdapter addiary = new SqlDataAdapter("select Distinct DiaryNo,Diary,Status,CourierNo as RefNo,MembershipNo as Membership From DiaryEntry where Status='AccReceive' and ExamSession='" + lblHiddenSeason.Text.ToString() + "' order by Diary desc", con); DataSet ds = new DataSet(); addiary.Fill(ds); if (ds.Tables[0].ToString() != "") { GridDiaryNo.DataSource = ds; GridDiaryNo.DataBind(); } SqlDataAdapter countDispatch = new SqlDataAdapter("select DairyNo,Status,IMID from DairyCount where DairyNo IN (select Distinct DiaryNo From DiaryEntry where Status='CountDispatch' and ExamSession='" + lblHiddenSeason.Text.ToString() + "') order by DairyNo desc ", con); DataSet ds1 = new DataSet(); countDispatch.Fill(ds1); if (ds1.Tables[0].ToString() != "") { GrdCountDispatch.DataSource = ds1; GrdCountDispatch.DataBind(); } }
protected void txtdevYearSeason_TextChanged(object sender, EventArgs e) { txtDiaryNo.Text = ""; lblhiddenSession.Text = ddlsession.SelectedValue.ToString() + "" + txtSession.Text.ToString(); GridDiaryNo.Focus(); }
protected void txtIDIM_TextChanged(object sender, EventArgs e) { txtIMID(); con.Dispose(); GridDiaryNo.Focus(); }