Example #1
0
    private void bindProject()
    {
        adp = new SqlDataAdapter("select SN,SID,StudentName,Session,Status,SynopsisStatus,EntryStatus from Project where SID='" + txtSid.Text.ToString() + "'", con);
        DataTable dt = new DataTable();

        adp.Fill(dt);
        GridEval.DataSource = dt;
        GridEval.DataBind();
    }
    private void BindGridEval()
    {
        adp = new SqlDataAdapter("select SID,StudentName,IMID,Course,Part,InstitutionID,Institution,CourseStatus from Project where Status='CopyDispatched' and Session='" + lblSessionHiddend.Text.ToString() + "' and EntryStatus='Running'", con);
        DataTable dt = new DataTable();

        adp.Fill(dt);
        GridEval.DataSource = dt;
        GridEval.DataBind();
    }
    protected void txtSID_OnTextChanted(object sender, EventArgs e)
    {
        adp = new SqlDataAdapter("select SN,SID,StudentName,Session,Status,SynopsisStatus,EntryStatus from Project where SID='" + txtSid.Text.ToString() + "'", con);
        DataTable dt = new DataTable();

        adp.Fill(dt);
        GridEval.DataSource = dt;
        GridEval.DataBind(); GridEval.Focus();
    }
 protected void txtSid_TextChanged(object sender, EventArgs e)
 {
     if (txtSid.Text == "")
     {
         lblexception.Text = "Please insert Membership No";
         txtSid.Focus();
     }
     else
     {
         adp = new SqlDataAdapter("select SID,StudentName,IMID,Course,Part,InstitutionID,Institution,CourseStatus from Project where Status='CopyDispatched' and SID='" + txtSid.Text.ToString() + "' and EntryStatus='Running'", con);
         DataTable dt = new DataTable();
         adp.Fill(dt);
         GridEval.DataSource = dt;
         GridEval.DataBind();
     }
 }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        DateTimeFormatInfo dtinfo = new DateTimeFormatInfo();

        dtinfo.ShortDatePattern = "dd/MM/yyyy";
        dtinfo.DateSeparator    = "/";
        try
        {
            if (txtSid.Text == "" | lblIMID.Text == "" | txtInstID.Text == "" | lblStuName.Text == "")
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('Please enter Details!')", true);
            }
            else
            {
                con.Open();
                cmd = new SqlCommand("select ID from InstitutionReg where Name='" + ddlOpn4.SelectedValue.ToString() + "'", con);
                string Insid = Convert.ToString(cmd.ExecuteScalar());
                cmd.ExecuteNonQuery();
                cmd = new SqlCommand("update Project set SID=@SID,Course=@Course,Part=@Part,InstitutionID=@InstitutionID,Institution=@Institution,GroupID=@GroupID,GroupMate1=@GroupMate1,GroupMate2=@GroupMate2,GroupMate3=@GroupMate3,OptionID=@OptionID,Option1=@Option1,Option2=@Option2,Option3=@Option3,Status=@Status,SynopsisStatus=@SynopsisStatus,ProjectNo=@ProjectNo,SynopsisTitle=@SynopsisTitle,ProjectTitle=@ProjectTitle,Description=@Description,Duration=@Duration,SynopsisRemarks=@SynopsisRemarks,Remark=@Remark,NoOfCopies=@NoOfCopies,DispatchNo=@DispatchNo,ApprovalFees=@ApprovalFees,EvalutionFees=@EvalutionFees,TrainingFees=@TrainingFees,GuidanceFees=@GuidanceFees,SynopsisDate=@SynopsisDate,ProjectDate=@ProjectDate,ProjectAppDate=@ProjectAppDate,LetterIssueDate=@LetterIssueDate,CopySubmitDate=@CopySubmitDate,SendDate=@SendDate,GradeDate=@GradeDate,EvalutionDate=@EvalutionDate,Grade=@Grade,DiaryA=@DiaryA,DiaryB=@DiaryB,DiaryC=@DiaryC,CourseStatus=@CourseStatus,LetterRemarks=@LetterRemarks where SN='" + Convert.ToInt32(GridEval.SelectedRow.Cells[1].Text) + "' and SID='" + GridEval.SelectedRow.Cells[2].Text + "'", con);
                cmd.Parameters.AddWithValue("@SID", txtSid.Text.ToString());
                cmd.Parameters.AddWithValue("@Course", ddlCourse.SelectedValue.ToString()); cmd.Parameters.AddWithValue("@Part", ddlPart.SelectedValue.ToString());
                cmd.Parameters.AddWithValue("@InstitutionID", txtInstID.Text.ToString()); cmd.Parameters.AddWithValue("@Institution", ddlOpn4.SelectedItem.Text);
                cmd.Parameters.AddWithValue("@GroupID", txtGP.Text.ToString()); cmd.Parameters.AddWithValue("@GroupMate1", txtGm1.Text.ToString()); cmd.Parameters.AddWithValue("@GroupMate2", txtGm2.Text.ToString()); cmd.Parameters.AddWithValue("@GroupMate3", txtGm3.Text.ToString());
                cmd.Parameters.AddWithValue("@OptionID", Insid.ToString()); cmd.Parameters.AddWithValue("@Option1", ddlOpn1.SelectedValue.ToString()); cmd.Parameters.AddWithValue("@Option2", ddlOpn2.SelectedValue.ToString()); cmd.Parameters.AddWithValue("@Option3", ddlOpn3.SelectedValue.ToString());
                cmd.Parameters.AddWithValue("@Status", ddlStatus.SelectedValue.ToString());
                cmd.Parameters.AddWithValue("@SynopsisStatus", ddlSynStatus.SelectedValue.ToString());
                cmd.Parameters.AddWithValue("@ProjectNo", txtProNo.Text.ToString());
                cmd.Parameters.AddWithValue("@SynopsisTitle", txtSynTtl.Text.ToString());
                cmd.Parameters.AddWithValue("@ProjectTitle", txtProTtl.Text.ToString());
                cmd.Parameters.AddWithValue("@Description", txtDes.Text.ToString());
                cmd.Parameters.AddWithValue("@Duration", txtDuration.Text.ToString());
                cmd.Parameters.AddWithValue("@SynopsisRemarks", txtSynRemark.Text.ToString());
                cmd.Parameters.AddWithValue("@Remark", txtRemark.Text.ToString());
                cmd.Parameters.AddWithValue("@NoOfCopies", ddlCopies.SelectedValue.ToString());
                cmd.Parameters.AddWithValue("@DispatchNo", txtDNo.Text.ToString());
                if (txtAppFees.Text == "")
                {
                    cmd.Parameters.AddWithValue("@ApprovalFees", "0");
                }
                else
                {
                    cmd.Parameters.AddWithValue("@ApprovalFees", txtAppFees.Text.ToString());
                }
                if (txtEvalFees.Text == "")
                {
                    cmd.Parameters.AddWithValue("@EvalutionFees", "0");
                }
                else
                {
                    cmd.Parameters.AddWithValue("@EvalutionFees", txtEvalFees.Text.ToString());
                }
                if (txtTraFees.Text == "")
                {
                    cmd.Parameters.AddWithValue("@TrainingFees", "0");
                }
                else
                {
                    cmd.Parameters.AddWithValue("@TrainingFees", txtTraFees.Text.ToString());
                }
                if (txtGuidFees.Text == "")
                {
                    cmd.Parameters.AddWithValue("@GuidanceFees", "0");
                }
                else
                {
                    cmd.Parameters.AddWithValue("@GuidanceFees", txtGuidFees.Text.ToString());
                }
                if (txtSynDate.Text == "")
                {
                    cmd.Parameters.AddWithValue("@SynopsisDate", DBNull.Value);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@SynopsisDate", Convert.ToDateTime(txtSynDate.Text.ToString(), dtinfo));
                }
                if (txtProDate.Text == "")
                {
                    cmd.Parameters.AddWithValue("@ProjectDate", DBNull.Value);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@ProjectDate", Convert.ToDateTime(txtProDate.Text.ToString(), dtinfo));
                }
                if (txtProAppDate.Text == "")
                {
                    cmd.Parameters.AddWithValue("@ProjectAppDate", DBNull.Value);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@ProjectAppDate", Convert.ToDateTime(txtProAppDate.Text.ToString(), dtinfo));
                }
                if (txtLetIsDate.Text == "")
                {
                    cmd.Parameters.AddWithValue("@LetterIssueDate", DBNull.Value);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@LetterIssueDate", Convert.ToDateTime(txtLetIsDate.Text.ToString(), dtinfo));
                }
                if (txtCpySubDate.Text == "")
                {
                    cmd.Parameters.AddWithValue("@CopySubmitDate", DBNull.Value);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@CopySubmitDate", Convert.ToDateTime(txtCpySubDate.Text.ToString(), dtinfo));
                }
                if (txtSenDate.Text == "")
                {
                    cmd.Parameters.AddWithValue("@SendDate", DBNull.Value);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@SendDate", Convert.ToDateTime(txtSenDate.Text.ToString(), dtinfo));
                }
                if (txtGDate.Text == "")
                {
                    cmd.Parameters.AddWithValue("@GradeDate", DBNull.Value);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@GradeDate", Convert.ToDateTime(txtGDate.Text.ToString(), dtinfo));
                }
                if (txtEvalDate.Text == "")
                {
                    cmd.Parameters.AddWithValue("@EvalutionDate", DBNull.Value);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@EvalutionDate", Convert.ToDateTime(txtEvalDate.Text.ToString(), dtinfo));
                }
                cmd.Parameters.AddWithValue("@Grade", ddlGrade.SelectedValue.ToString());
                cmd.Parameters.AddWithValue("@DiaryA", txtDA.Text.ToString()); cmd.Parameters.AddWithValue("@DiaryB", txtDB.Text.ToString()); cmd.Parameters.AddWithValue("@DiaryC", txtDC.Text.ToString());
                cmd.Parameters.AddWithValue("@CourseStatus", ddlCourseStatus.SelectedValue.ToString());
                cmd.Parameters.AddWithValue("@LetterRemarks", txtLetRemark.Text.ToString());
                cmd.ExecuteNonQuery();
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('Data Updated Successfully!')", true);
                lblIMID.Text = ""; txtSid.Text = ""; lblStuName.Text = ""; txtInstID.Text = ""; txtGP.Text = ""; txtGm1.Text = ""; txtGm2.Text = ""; txtGm3.Text = ""; txtProNo.Text = ""; txtSynTtl.Text = ""; txtProTtl.Text = ""; txtDes.Text = ""; txtDuration.Text = ""; txtDNo.Text = ""; txtSynRemark.Text = ""; txtRemark.Text = ""; txtLetRemark.Text = ""; txtAppFees.Text = ""; txtAppFees.Text = ""; txtTraFees.Text = ""; txtGuidFees.Text = ""; txtDA.Text = ""; txtDB.Text = ""; txtDC.Text = ""; txtEvalFees.Text = ""; txtSynDate.Text = ""; txtProDate.Text = ""; txtProAppDate.Text = ""; txtLetIsDate.Text = ""; txtCpySubDate.Text = ""; txtSenDate.Text = ""; txtGDate.Text = ""; txtEvalDate.Text = ""; txtSid.Focus();
            }
        }
        catch (NullReferenceException ex) { lblException.Text = ex.ToString(); }
        catch (FormatException ex) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "success", "alert('Please enter Correct Date!')", true); }
        catch (OutOfMemoryException ex) { lblException.Text = ex.ToString(); }
        con.Close(); con.Dispose();  GridEval.Focus();
    }