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