protected void DeleteFromGrid(int rowindex) { DataTable dt = new DataTable(); dt = (DataTable)ViewState["data"]; dt.Rows[rowindex].Delete(); dt.AcceptChanges(); Gridreqinfo.DataSource = dt; Gridreqinfo.DataBind(); ViewState["data"] = dt; statuslable.Text = "Record Deleted successfully."; statuslable.Visible = true; }
protected void FillGrid() { DataTable dt = new DataTable(); lblcomname.Text = ddlbusiness.SelectedItem.Text; lblfolder.Text = ddltypeofdoc.SelectedItem.Text; lbldrower.Text = ddldrower.SelectedItem.Text; lblcabi.Text = ddlcabinet.SelectedItem.Text; lblstatusprint.Text = ddlstatus.SelectedItem.Text; DataTable dt2 = new DataTable(); string valid = ""; string Status = ""; string datesearch = ""; if (txtFromDate.Text != "" && txtToDate.Text != "") { datesearch = " and Cast(DocumentMaster.DocumentUploadDate as Date) between '" + txtFromDate.Text + "' and '" + txtToDate.Text + "' "; } if (ddlstatus.SelectedItem.Text == "All") { Status = ""; } else if (ddlstatus.SelectedItem.Text == "Pending") { Status = " AND DocumentMaster.DocumentId Not in(Select DocumentEmpApproveLog.DocumentId from DocumentMainType inner join DocumentSubType on DocumentSubType.DocumentMainTypeId=DocumentMainType.DocumentMainTypeId inner join DocumentType on DocumentType.DocumentSubTypeId=DocumentSubType.DocumentSubTypeId inner join DocumentMaster ON DocumentMaster.DocumentTypeId = DocumentType.DocumentTypeId inner join DocumentEmpApproveLog on DocumentEmpApproveLog.DocumentId=DocumentMaster.DocumentId where DocumentMainType.Whid='" + ddlbusiness.SelectedValue + "' and (DocumentEmpApproveLog.Approve='1' or DocumentEmpApproveLog.Approve='0') and DocumentEmpApproveLog.EmployeeID='" + Session["EmployeeId"] + "')"; } else if (ddlstatus.SelectedItem.Text == "Reject") { Status = " AND DocumentMaster.DocumentId in(Select DocumentEmpApproveLog.DocumentId from DocumentMainType inner join DocumentSubType on DocumentSubType.DocumentMainTypeId=DocumentMainType.DocumentMainTypeId inner join DocumentType on DocumentType.DocumentSubTypeId=DocumentSubType.DocumentSubTypeId inner join DocumentMaster ON DocumentMaster.DocumentTypeId = DocumentType.DocumentTypeId inner join DocumentEmpApproveLog on DocumentEmpApproveLog.DocumentId=DocumentMaster.DocumentId where DocumentMainType.Whid='" + ddlbusiness.SelectedValue + "' and (DocumentEmpApproveLog.Approve='0') and DocumentEmpApproveLog.EmployeeID='" + Session["EmployeeId"] + "')"; } else if (ddlstatus.SelectedItem.Text == "Accept") { Status = " AND DocumentMaster.DocumentId in(Select DocumentEmpApproveLog.DocumentId from DocumentMainType inner join DocumentSubType on DocumentSubType.DocumentMainTypeId=DocumentMainType.DocumentMainTypeId inner join DocumentType on DocumentType.DocumentSubTypeId=DocumentSubType.DocumentSubTypeId inner join DocumentMaster ON DocumentMaster.DocumentTypeId = DocumentType.DocumentTypeId inner join DocumentEmpApproveLog on DocumentEmpApproveLog.DocumentId=DocumentMaster.DocumentId where DocumentMainType.Whid='" + ddlbusiness.SelectedValue + "' and (DocumentEmpApproveLog.Approve='1') and DocumentEmpApproveLog.EmployeeID='" + Session["EmployeeId"] + "')"; } if (ddltypeofdoc.SelectedIndex > 0) { valid = " and (DocumentMaster.DocumentTypeId ='" + ddltypeofdoc.SelectedValue + "') "; } else if (ddldrower.SelectedIndex > 0) { valid = " and (DocumentSubType.DocumentSubTypeId ='" + ddldrower.SelectedValue + "') "; } else if (ddlcabinet.SelectedIndex > -1) { valid = " and (DocumentMainType.DocumentMainTypeId ='" + ddlcabinet.SelectedValue + "') "; } valid = valid + " and (DocumentMaster.DocumentTypeId In(SELECT Distinct DocumentAccessRightMaster.DocumentTypeId FROM DocumentMainType inner join DocumentSubType on DocumentSubType.DocumentMainTypeId=DocumentMainType.DocumentMainTypeId inner join DocumentType on DocumentType.DocumentSubTypeId=DocumentSubType.DocumentSubTypeId inner join DocumentAccessRightMaster on DocumentAccessRightMaster.DocumentTypeId=DocumentType.DocumentTypeId WHERE DocumentMainType.Whid='" + ddlbusiness.SelectedValue + "' and (DocumentAccessRightMaster.CID='" + Session["Comid"] + "') and((ViewAccess='true') or (DeleteAccess='true') or (SaveAccess='true') or (EditAccess='true') or (EmailAccess='true') or (FaxAccess='true') or (PrintAccess='true') or (MessageAccess='true'))))"; dt2 = select("SELECT DISTINCT DocumentMaster.DocumentId,DocumentMainType.Whid, DocumentMaster.DocumentTypeId, DocumentMaster.DocumentUploadTypeId, DocumentMaster.DocumentName, DocumentMaster.DocumentUploadDate,DocumentMaster.DocumentDate, DocumentMaster.DocumentTitle, DocumentMaster.Description, DocumentMaster.PartyId, DocumentMaster.DocumentRefNo, DocumentMaster.DocumentAmount, DocumentMaster.EmployeeId,DocumentMaster.FileExtensionType, DocumentType.DocumentType, Party_Master.Compname as PartyName FROM DocumentMainType inner join DocumentSubType on DocumentSubType.DocumentMainTypeId=DocumentMainType.DocumentMainTypeId inner join DocumentType on DocumentType.DocumentSubTypeId=DocumentSubType.DocumentSubTypeId inner join DocumentMaster ON DocumentMaster.DocumentTypeId = DocumentType.DocumentTypeId LEFT OUTER JOIN DocumentProcessing ON DocumentMaster.DocumentId = DocumentProcessing.DocumentId LEFT OUTER JOIN Party_Master ON DocumentMaster.PartyId = Party_Master.PartyId WHERE (DocumentMainType.Whid='" + ddlbusiness.SelectedValue + "') " + valid + " " + Status + " " + datesearch + " AND DocumentMaster.DocumentId in ( SELECT DocumentId FROM DocumentProcessing WHERE (Approve = 1) ) AND DocumentMaster.DocumentId not in ( SELECT DocumentId FROM DocumentProcessing WHERE (Approve = 0) or (Approve is null) ) and(DocumentMaster.CID='" + Session["Comid"] + "')"); DataView dv = dt2.DefaultView; if (dv.Table.Rows.Count > 0) { dv.Sort = "DocumentId desc"; } Gridreqinfo.DataSource = dt2; DataView myDataView = new DataView(); myDataView = dt2.DefaultView; if (hdnsortExp.Value != string.Empty) { myDataView.Sort = string.Format("{0} {1}", hdnsortExp.Value, hdnsortDir.Value); } Gridreqinfo.DataBind(); int gridrow = 0; if (Gridreqinfo.Rows.Count > 0) { dt = clsDocument.SelectDocumentAccessRigthsByDesignationID(); do { foreach (DataRow ddr in dt.Rows) { if (Convert.ToInt32(Gridreqinfo.DataKeys[gridrow].Value) == Convert.ToInt32(ddr["DocumentTypeId"])) { Gridreqinfo.Rows[gridrow].Cells[9].Enabled = Convert.ToBoolean(ddr["EditAccess"]); Gridreqinfo.Rows[gridrow].Cells[10].Enabled = Convert.ToBoolean(ddr["DeleteAccess"]); Gridreqinfo.Rows[gridrow].Cells[5].Enabled = Convert.ToBoolean(ddr["ViewAccess"]); } } // ===fill drop down inside gridview DropDownList ddlApproveType = (DropDownList)Gridreqinfo.Rows[gridrow].FindControl("ddlApprovetype"); DataTable dt3 = new DataTable(); dt3 = clsInstruction.SelectRuleApproveTypeMaster(ddlbusiness.SelectedValue); ddlApproveType.DataSource = dt3; ddlApproveType.DataTextField = "RuleApproveTypeName"; ddlApproveType.DataValueField = "RuleApproveTypeId"; ddlApproveType.DataBind(); ddlApproveType.Items.Insert(0, "None"); ddlApproveType.Items[0].Value = "0"; gridrow = gridrow + 1; }while (gridrow <= Gridreqinfo.Rows.Count - 1); foreach (GridViewRow gdr in Gridreqinfo.Rows) { DropDownList ddlApprovetype1 = (DropDownList)gdr.FindControl("ddlApprovetype"); if (ddlstatus.SelectedItem.Text != "Pending") { DataTable dt4 = new DataTable(); Label lnbvvd = (Label)gdr.FindControl("lnbvvd"); dt4 = clsDocument.SelectDocumentEmpApproveLogByDocId(Convert.ToInt32(lnbvvd.Text), Convert.ToInt32(Session["EmployeeId"])); if (dt4.Rows.Count > 0) { RadioButtonList rbt = (RadioButtonList)gdr.FindControl("rbtnAcceptReject"); TextBox txtNote = (TextBox)gdr.FindControl("TextBox3"); Label lbltxtnote = (Label)gdr.FindControl("lbltxtnote"); rbt.SelectedValue = dt4.Rows[0]["Approve"].ToString(); ddlApprovetype1.SelectedValue = dt4.Rows[0]["DocumentApproveTypeId"].ToString(); txtNote.Text = dt4.Rows[0]["Note"].ToString(); lbltxtnote.Text = dt4.Rows[0]["Note"].ToString(); txtNote.Enabled = false; rbt.Enabled = false; ddlApprovetype1.Enabled = false; } } if (ddlApprovetype1.SelectedValue == "0") { LinkButton lnkapp = (LinkButton)gdr.FindControl("lnkapp"); lnkapp.Visible = false; } } if (ddlstatus.SelectedItem.Text == "Accept" || ddlstatus.SelectedItem.Text == "Reject") { imgbtnSubmit.Visible = false; } else { imgbtnSubmit.Visible = true; } } }
protected void filleditgrid() { DataTable dt = new DataTable(); lblcomname.Text = ddlbusiness.SelectedItem.Text; lblfolder.Text = ddltypeofdoc.SelectedItem.Text; lbldrower.Text = ddldrower.SelectedItem.Text; lblcabi.Text = ddlcabinet.SelectedItem.Text; lblstatusprint.Text = ddlstatus.SelectedItem.Text; DataTable dt2 = new DataTable(); string valid = ""; string Status = ""; string datesearch = ""; if (txtFromDate.Text != "" && txtToDate.Text != "") { datesearch = " and DocumentMaster.DocumentUploadDate between '" + txtFromDate.Text + "' and '" + txtToDate.Text + "' "; } if (ddlstatus.SelectedItem.Text == "All") { Status = ""; } else if (ddlstatus.SelectedItem.Text == "Pending") { Status = " AND DocumentMaster.DocumentId Not in(Select DocumentEmpApproveLog.DocumentId from DocumentMainType inner join DocumentSubType on DocumentSubType.DocumentMainTypeId=DocumentMainType.DocumentMainTypeId inner join DocumentType on DocumentType.DocumentSubTypeId=DocumentSubType.DocumentSubTypeId inner join DocumentMaster ON DocumentMaster.DocumentTypeId = DocumentType.DocumentTypeId inner join DocumentEmpApproveLog on DocumentEmpApproveLog.DocumentId=DocumentMaster.DocumentId where DocumentMainType.Whid='" + ddlbusiness.SelectedValue + "' and (DocumentEmpApproveLog.Approve='1' or DocumentEmpApproveLog.Approve='0') and DocumentEmpApproveLog.EmployeeID='" + Session["EmployeeId"] + "')"; } else if (ddlstatus.SelectedItem.Text == "Reject") { Status = " AND DocumentMaster.DocumentId in(Select DocumentEmpApproveLog.DocumentId from DocumentMainType inner join DocumentSubType on DocumentSubType.DocumentMainTypeId=DocumentMainType.DocumentMainTypeId inner join DocumentType on DocumentType.DocumentSubTypeId=DocumentSubType.DocumentSubTypeId inner join DocumentMaster ON DocumentMaster.DocumentTypeId = DocumentType.DocumentTypeId inner join DocumentEmpApproveLog on DocumentEmpApproveLog.DocumentId=DocumentMaster.DocumentId where DocumentMainType.Whid='" + ddlbusiness.SelectedValue + "' and (DocumentEmpApproveLog.Approve='0') and DocumentEmpApproveLog.EmployeeID='" + Session["EmployeeId"] + "')"; } else if (ddlstatus.SelectedItem.Text == "Accept") { Status = " AND DocumentMaster.DocumentId in(Select DocumentEmpApproveLog.DocumentId from DocumentMainType inner join DocumentSubType on DocumentSubType.DocumentMainTypeId=DocumentMainType.DocumentMainTypeId inner join DocumentType on DocumentType.DocumentSubTypeId=DocumentSubType.DocumentSubTypeId inner join DocumentMaster ON DocumentMaster.DocumentTypeId = DocumentType.DocumentTypeId inner join DocumentEmpApproveLog on DocumentEmpApproveLog.DocumentId=DocumentMaster.DocumentId where DocumentMainType.Whid='" + ddlbusiness.SelectedValue + "' and (DocumentEmpApproveLog.Approve='1') and DocumentEmpApproveLog.EmployeeID='" + Session["EmployeeId"] + "')"; } if (ddltypeofdoc.SelectedIndex > 0) { valid = " and (DocumentMaster.DocumentTypeId ='" + ddltypeofdoc.SelectedValue + "') "; } else if (ddldrower.SelectedIndex > 0) { valid = " and (DocumentSubType.DocumentSubTypeId ='" + ddldrower.SelectedValue + "') "; } else if (ddlcabinet.SelectedIndex > -1) { valid = " and (DocumentMainType.DocumentMainTypeId ='" + ddlcabinet.SelectedValue + "') "; } dt2 = select("SELECT DISTINCT DocumentMaster.DocumentId,DocumentMainType.Whid, DocumentMaster.DocumentTypeId, DocumentMaster.DocumentUploadTypeId, DocumentMaster.DocumentName, DocumentMaster.DocumentUploadDate,DocumentMaster.DocumentDate, DocumentMaster.DocumentTitle, DocumentMaster.Description, DocumentMaster.PartyId, DocumentMaster.DocumentRefNo, DocumentMaster.DocumentAmount, DocumentMaster.EmployeeId,DocumentMaster.FileExtensionType, DocumentType.DocumentType, Party_Master.Compname as PartyName FROM DocumentMainType inner join DocumentSubType on DocumentSubType.DocumentMainTypeId=DocumentMainType.DocumentMainTypeId inner join DocumentType on DocumentType.DocumentSubTypeId=DocumentSubType.DocumentSubTypeId inner join DocumentMaster ON DocumentMaster.DocumentTypeId = DocumentType.DocumentTypeId LEFT OUTER JOIN DocumentProcessing ON DocumentMaster.DocumentId = DocumentProcessing.DocumentId LEFT OUTER JOIN Party_Master ON DocumentMaster.PartyId = Party_Master.PartyId WHERE (DocumentMainType.Whid='" + ddlbusiness.SelectedValue + "') " + valid + " " + Status + " " + datesearch + " AND DocumentMaster.DocumentId in ( SELECT DocumentId FROM DocumentProcessing WHERE (Approve = 1) ) AND DocumentMaster.DocumentId not in ( SELECT DocumentId FROM DocumentProcessing WHERE (Approve = 0) or (Approve is null) ) and(DocumentMaster.CID='" + Session["Comid"] + "')"); DataView dv = dt2.DefaultView; if (dv.Table.Rows.Count > 0) { dv.Sort = "DocumentId desc"; } Gridreqinfo.DataSource = dt2; DataView myDataView = new DataView(); myDataView = dt2.DefaultView; if (hdnsortExp.Value != string.Empty) { myDataView.Sort = string.Format("{0} {1}", hdnsortExp.Value, hdnsortDir.Value); } Gridreqinfo.DataBind(); }
protected void ddldesi_SelectedIndexChanged(object sender, EventArgs e) { ViewState["data"] = null; DataTable ds = select("Select Distinct DesignationQualificationRequiredMasterTbl.* from DesignationQualificationRequiredMasterTbl where DesignationId='" + ddldesi.SelectedValue + "' and [BusinessId]='" + ddlwarehouse.SelectedValue + "'"); if (ds.Rows.Count > 0) { ViewState["did"] = Convert.ToString(ds.Rows[0]["Id"]); ddlsex.SelectedIndex = ddlsex.Items.IndexOf(ddlsex.Items.FindByValue(Convert.ToString(ds.Rows[0]["Preferredsex"]))); txttoage.Text = Convert.ToString(ds.Rows[0]["Preferredagemax"]); txtfromage.Text = Convert.ToString(ds.Rows[0]["Preferredagemin"]); txtothenote.Text = Convert.ToString(ds.Rows[0]["Othenotes"]); txtexpreq.Text = Convert.ToString(ds.Rows[0]["ExperienceYrs"]); //ddlwarehouse.SelectedIndex = ddlwarehouse.Items.IndexOf(ddlwarehouse.Items.FindByValue(Convert.ToString(ds.Rows[0]["BusinessId"]))); //ddlwarehouse_SelectedIndexChanged(sender, e); DataTable dsqu = select("Select Distinct AreaofStudiesTbl.Name,DesignationQualificationsRequiredDetailTbl.Id, [DesignationQualificationsRequiredDetailTbl].AreaofstudyId,DesignationQualificationsRequiredDetailTbl.[EducationDegreeId],DesignationQualificationsRequiredDetailTbl.[SpecialisationsubjectId],DesignationQualificationsRequiredDetailTbl.[PassinggreadId]," + "Case When(DegreeName IS NULL) then 'Any' else DegreeName End as edudegree ,Case When(PassingGrade.Name IS NULL) then 'Any' else PassingGrade.Name End as passGrade,Case When(SubjectName IS NULL) then 'Any' else SubjectName End as spsubject from DesignationQualificationsRequiredDetailTbl inner join AreaofStudiesTbl on AreaofStudiesTbl.Id=DesignationQualificationsRequiredDetailTbl.AreaofstudyId Left join " + "[EducationDegrees] on [EducationDegrees].Id =DesignationQualificationsRequiredDetailTbl.EducationDegreeId left join PassingGrade on PassingGrade.Id=DesignationQualificationsRequiredDetailTbl.PassinggreadId left join SpecialisedSubjectTBL on SpecialisedSubjectTBL.Id=DesignationQualificationsRequiredDetailTbl.SpecialisationsubjectId " + " where DesignationQualificationsrequiredmastertblId='" + ds.Rows[0]["Id"] + "'"); DataTable dt = new DataTable(); if (Convert.ToString(ViewState["data"]) == "") { dt = CreateDatatable(); } else { dt = (DataTable)ViewState["data"]; } foreach (DataRow drs in dsqu.Rows) { DataRow Drow = dt.NewRow(); Drow["AreaStudy"] = Convert.ToString(drs["Name"]); Drow["edudegree"] = Convert.ToString(drs["edudegree"]); Drow["passGrade"] = Convert.ToString(drs["passGrade"]); Drow["spsubject"] = Convert.ToString(drs["spsubject"]); Drow["Whid"] = ddlwarehouse.SelectedValue; Drow["areaid"] = Convert.ToString(drs["AreaofstudyId"]); Drow["edudegreeid"] = Convert.ToString(drs["EducationDegreeId"]); Drow["passgradeid"] = Convert.ToString(drs["PassinggreadId"]); Drow["spsubid"] = Convert.ToString(drs["SpecialisationsubjectId"]); Drow["Id"] = Convert.ToString(drs["Id"]); dt.Rows.Add(Drow); ViewState["data"] = dt; Gridreqinfo.DataSource = dt; Gridreqinfo.DataBind(); //ddlareaofstudy.SelectedIndex = ddlareaofstudy.Items.IndexOf(ddlareaofstudy.Items.FindByValue(Convert.ToString(ds.Rows[0]["AreaofstudyId"]))); //ddlareaofstudy_SelectedIndexChanged(sender, e); //ddledudeg.SelectedIndex = ddledudeg.Items.IndexOf(ddledudeg.Items.FindByValue(Convert.ToString(ds.Rows[0]["EducationDegreeId"]))); //ddlpassinggrade.SelectedIndex = ddlpassinggrade.Items.IndexOf(ddlpassinggrade.Items.FindByValue(Convert.ToString(ds.Rows[0]["PassinggreadId"]))); //ddlspecialisub.SelectedIndex = ddlspecialisub.Items.IndexOf(ddlspecialisub.Items.FindByValue(Convert.ToString(ds.Rows[0]["SpecialisationsubjectId"]))); //ddlsex.SelectedIndex = ddlsex.Items.IndexOf(ddlsex.Items.FindByValue(Convert.ToString(ds.Rows[0]["Preferredsex"]))); } DataTable dsqusk = select("Select Distinct SkillType.Id from DesignationQualificationskillsTbl inner join SkillName on SkillName.Id=DesignationQualificationskillsTbl.SkillnameId inner join [SkillType] on [SkillType].Id=[SkillName].[SkillTypeID] where DesignationQualificationsrequiredmastertblId='" + ds.Rows[0]["Id"] + "'"); if (dsqusk.Rows.Count > 0) { chkyes.Checked = true; chkyes_CheckedChanged(sender, e); foreach (DataRow drs in dsqusk.Rows) { foreach (DataListItem dti in datalistskilltype.Items) { string i = datalistskilltype.DataKeys[dti.ItemIndex].ToString(); CheckBox chkprocess = (CheckBox)dti.FindControl("chksp"); if (Convert.ToString(drs["Id"]) == i) { chkprocess.Checked = true; } } } chksp_CheckedChanged(sender, e); } else { pnljobid.Visible = true; fillskilltype(); } DataTable dsqusk1 = select("Select Distinct DesignationQualificationskillsTbl.Id as did, SkillName.Id as SkillId,SkillType.Id from DesignationQualificationskillsTbl inner join SkillName on SkillName.Id=DesignationQualificationskillsTbl.SkillnameId inner join [SkillType] on [SkillType].Id=[SkillName].[SkillTypeID] where DesignationQualificationsrequiredmastertblId='" + ds.Rows[0]["Id"] + "'"); if (dsqusk1.Rows.Count > 0) { //chkyes.Checked = true; //chkyes_CheckedChanged(sender, e); foreach (DataRow drs in dsqusk1.Rows) { foreach (GridViewRow dti in GridView1.Rows) { string i = GridView1.DataKeys[dti.RowIndex].Value.ToString(); if (Convert.ToString(drs["Id"]) == i) { DataList datatlistskillname = (DataList)dti.FindControl("datatlistskillname"); foreach (DataListItem dee in datatlistskillname.Items) { string key = datatlistskillname.DataKeys[dee.ItemIndex].ToString(); Label lblid = (Label)dee.FindControl("lblid"); CheckBox chkprocess = (CheckBox)dee.FindControl("chksp"); if (Convert.ToString(drs["SkillId"]) == key) { lblid.Text = (Convert.ToString(drs["did"])); chkprocess.Checked = true; } } } } } } else { GridView1.DataSource = null; GridView1.DataBind(); } enableview(false); btnsubmit.Visible = false; btnedit.Visible = true; btnupdate.Visible = false; //CheckBox1.Checked = true; CheckBox1.Enabled = false; //CheckBox1_CheckedChanged(sender, e); //CheckBox2.Checked = true; CheckBox2.Enabled = false; //CheckBox2_CheckedChanged(sender, e); //CheckBox3.Checked = true; CheckBox3.Enabled = false; //CheckBox3_CheckedChanged(sender, e); panelexpr.Visible = true; panelother.Visible = true; paneleduca.Visible = true; CheckBox1.Visible = false; CheckBox2.Visible = false; CheckBox3.Visible = false; chkyes.Visible = false; lblis.Visible = true; } else { CheckBox1.Visible = true; CheckBox2.Visible = true; CheckBox3.Visible = true; CheckBox3.Checked = true; CheckBox3_CheckedChanged(sender, e); chkyes.Visible = true; CheckBox1.Checked = false; CheckBox2.Checked = false; panelexpr.Visible = false; panelother.Visible = false; CheckBox1.Enabled = true; CheckBox2.Enabled = true; CheckBox3.Enabled = true; enableview(true); btnsubmit.Visible = false; btnedit.Visible = false; btnupdate.Visible = false; Gridreqinfo.DataSource = null; Gridreqinfo.DataBind(); datalistskilltype.DataSource = null; datalistskilltype.DataBind(); GridView1.DataSource = null; GridView1.DataBind(); txtexpreq.Text = ""; txtfromage.Text = ""; txtothenote.Text = ""; txttoage.Text = ""; chkyes.Checked = false; chkyes_CheckedChanged(sender, e); } }
protected void btnadd_Click(object sender, EventArgs e) { if (btnupdate.Visible == true) { } else { btnsubmit.Visible = true; } //Label1.Visible = true; string all = ""; DataTable dt = new DataTable(); if (Convert.ToString(ViewState["data"]) == "") { dt = CreateDatatable(); } else { dt = (DataTable)ViewState["data"]; } Label lblareaId = new Label(); foreach (GridViewRow sdr in Gridreqinfo.Rows) { lblareaId = (Label)sdr.FindControl("lblareaId"); if (Convert.ToString(lblareaId.Text) == ddlareaofstudy.SelectedValue.ToString()) { all = "ab"; statuslable.Text = "Record already exist"; statuslable.Visible = true; break; } } if (all != "ab") { DataRow Drow = dt.NewRow(); Drow["AreaStudy"] = ddlareaofstudy.SelectedItem.Text; Drow["edudegree"] = ddledudeg.SelectedItem.Text; Drow["passGrade"] = ddlpassinggrade.SelectedItem.Text; Drow["spsubject"] = ddlspecialisub.SelectedItem.Text; Drow["Whid"] = ddlwarehouse.SelectedValue; Drow["areaid"] = ddlareaofstudy.SelectedValue; Drow["edudegreeid"] = ddledudeg.SelectedValue; Drow["passgradeid"] = ddlpassinggrade.SelectedValue; Drow["spsubid"] = ddlspecialisub.SelectedValue; Drow["Id"] = "0"; all = ""; dt.Rows.Add(Drow); ViewState["data"] = dt; Gridreqinfo.DataSource = dt; Gridreqinfo.DataBind(); pnledu.Visible = false; btnaddnew.Visible = true; } }
protected void FillGrid() { lblcompany.Text = Session["Cname"].ToString(); lblcomname.Text = ddlbusiness.SelectedItem.Text; lblcabinetdrawerfolderprint.Text = ddldoctype.SelectedItem.Text; lbldocidprint.Text = ddllistofdocument.SelectedItem.Text; lblsearchbytitleprint.Text = txtsearch.Text; string strbydoctype = ""; string strbydocid = ""; string strsearch = ""; string strparty = ""; string strbyperiod = ""; string strbydate = ""; string stremployee = ""; string strstatus = ""; if (ddldoctype.SelectedIndex > 0) { strbydoctype = " and DocumentMaster.DocumentTypeId ='" + ddldoctype.SelectedValue + "' "; } if (ddllistofdocument.SelectedIndex > 0) { strbydocid = " and DocumentMaster.DocumentId='" + ddllistofdocument.SelectedValue + "' "; } if (txtsearch.Text != "") { strsearch = " and DocumentMaster.DocumentTitle Like '%" + txtsearch.Text.Replace("'", "''") + "%' "; } if (CheckBox1.Checked == true) { if (ddlfilterbyparty.SelectedIndex > 0) { strparty = " and DocumentMaster.PartyId='" + ddlfilterbyparty.SelectedValue + "' "; } } strbydoctype = strbydoctype + " and DocumentMaster.DocumentTypeId IN( SELECT Distinct DocumentAccessRightMaster.DocumentTypeId FROM DocumentAccessRightMaster inner join DocumentType on DocumentType.DocumentTypeId=DocumentAccessRightMaster.DocumentTypeId WHERE DesignationId ='" + Session["DesignationId"] + "' and (DocumentAccessRightMaster.CID='" + Session["Comid"] + "') and((ViewAccess='true') or (DeleteAccess='true') or (SaveAccess='true') or (EditAccess='true') or (EmailAccess='true') or (FaxAccess='true') or (PrintAccess='true') or (MessageAccess='true')))"; if (RadioButtonList1.SelectedValue == "0") { if (ViewState["periodstartdate"] != null && ViewState["periodenddate"] != null) { strbyperiod = " and DocumentMaster.DocumentUploadDate between '" + ViewState["periodstartdate"].ToString() + "' and '" + ViewState["periodenddate"].ToString() + "'"; } } if (RadioButtonList1.SelectedValue == "1") { if (txtfrom.Text != "" && txtto.Text != "") { strbydate = " and DocumentMaster.DocumentUploadDate between '" + txtfrom.Text + "' and '" + txtto.Text + "'"; } } if (ddlemployee.SelectedIndex > 0) { stremployee = " and DocumentEmpApproveLog.EmployeeID='" + ddlemployee.SelectedValue + "' "; } if (ddlstatus.SelectedValue != "2") { strstatus = " and DocumentEmpApproveLog.Approve='" + ddlstatus.SelectedValue + "'"; } string str = " DocumentEmpApproveLog.ApproveDate, EmployeeMaster.EmployeeName, DocumentEmpApproveLog.DocumentId, DocumentEmpApproveLog.Approve,case when (DocumentEmpApproveLog.Approve='1') Then 'Accepted' else 'Rejected' End as Approvelabel, Left(DocumentEmpApproveLog.Note,25) as Notesmall,DocumentEmpApproveLog.Note ,DocumentType.DocumentType, DocumentEmpApproveLog.EmployeeID, DocumentMaster.DocumentTypeId, DocumentMaster.DocumentTitle, DocumentMaster.DocumentUploadTypeId, Convert(nvarchar,DocumentMaster.DocumentUploadDate,101) as DocumentUploadDate, DocumentMaster.DocumentName, DocumentMaster.PartyId, DocumentMaster.Description, DocumentMaster.DocumentRefNo, DocumentMaster.DocumentAmount, Party_Master.Compname as PartyName, RuleApproveTypeMaster.RuleApproveTypeName as DocumentApproveType FROM DocumentMainType inner join DocumentSubType on DocumentSubType.DocumentMainTypeId=DocumentMainType.DocumentMainTypeId inner join DocumentType on DocumentType.DocumentSubTypeId=DocumentSubType.DocumentSubTypeId inner join DocumentMaster ON DocumentMaster.DocumentTypeId = DocumentType.DocumentTypeId INNER JOIN DocumentEmpApproveLog ON DocumentMaster.DocumentId = DocumentEmpApproveLog.DocumentId LEFT OUTER JOIN RuleApproveTypeMaster ON DocumentEmpApproveLog.DocumentApproveTypeId = RuleApproveTypeMaster.RuleApproveTypeId LEFT OUTER JOIN EmployeeMaster ON DocumentEmpApproveLog.EmployeeID = EmployeeMaster.EmployeeMasterID LEFT OUTER JOIN Party_Master ON DocumentMaster.PartyId = Party_master.PartyId where DocumentMainType.Whid='" + ddlbusiness.SelectedValue + "' and DocumentMaster.CID='" + Session["Comid"] + "' " + strbydoctype + " " + strbydocid + " " + strsearch + " " + strparty + " " + strbyperiod + " " + strbydate + " " + stremployee + " " + strstatus + " "; string str2 = "select count(DocumentEmpApproveLog.DocumentId) as ci FROM DocumentMainType inner join DocumentSubType on DocumentSubType.DocumentMainTypeId=DocumentMainType.DocumentMainTypeId inner join DocumentType on DocumentType.DocumentSubTypeId=DocumentSubType.DocumentSubTypeId inner join DocumentMaster ON DocumentMaster.DocumentTypeId = DocumentType.DocumentTypeId INNER JOIN DocumentEmpApproveLog ON DocumentMaster.DocumentId = DocumentEmpApproveLog.DocumentId LEFT OUTER JOIN RuleApproveTypeMaster ON DocumentEmpApproveLog.DocumentApproveTypeId = RuleApproveTypeMaster.RuleApproveTypeId LEFT OUTER JOIN EmployeeMaster ON DocumentEmpApproveLog.EmployeeID = EmployeeMaster.EmployeeMasterID LEFT OUTER JOIN Party_Master ON DocumentMaster.PartyId = Party_master.PartyId where DocumentMainType.Whid='" + ddlbusiness.SelectedValue + "' and DocumentMaster.CID='" + Session["Comid"] + "' " + strbydoctype + " " + strbydocid + " " + strsearch + " " + strparty + " " + strbyperiod + " " + strbydate + " " + stremployee + " " + strstatus + " "; Gridreqinfo.VirtualItemCount = GetRowCount(str2); string sortExpression = " DocumentEmpApproveLog.ApproveDate "; if (Convert.ToInt32(ViewState["count"]) > 0) { DataTable dtcat = GetDataPage(Gridreqinfo.PageIndex, Gridreqinfo.PageSize, sortExpression, str); Gridreqinfo.DataSource = dtcat; DataView myDataView = new DataView(); myDataView = dtcat.DefaultView; if (hdnsortExp.Value != string.Empty) { myDataView.Sort = string.Format("{0} {1}", hdnsortExp.Value, hdnsortDir.Value); } Gridreqinfo.DataBind(); } }