// /* // Create By :- Kunal // Created Date :- 13/3/2015 // Updated Date :- // Purpose :- Add Edit Work Upload File //*/ // #region-----------UploadButton_Click------------ // protected void UploadButton_Click(object sender, EventArgs e) // { // try // { // if (FileUpload1.HasFile) // { // string fileName = Path.GetFileName(FileUpload1.PostedFile.FileName); // string fileExt = System.IO.Path.GetExtension(FileUpload1.PostedFile.FileName); // if (fileExt == ".doc" || fileExt == ".docx") // { // try // { // Session["uploadedfile"] = fileName; // if (Request.QueryString["ProjectId"] != null) // { // projectid = int.Parse(Request.QueryString["ProjectId"]); // FileUpload(projectid); // } // else // { // projectid = getMaxProjectId(); // FileUpload(projectid); // //cbpdf.Visible = true; // //btnOpenAddWrk.Enabled = true; // } // } // catch // { // lblMessageFile.Text = "Some Error occured."; // } // } // else // { // lblMessageFile.Text = "File is not valid please select .doc or .docx file only."; // } // } // } // catch (Exception ex) // { // lblCatchError.Text = ex.Message.ToString(); // } // } // #endregion // char suffix = 'a'; string file = ""; // protected void FileUpload(int projectid) // { // try // { // string dirPath = Server.MapPath("~/Document/"); // string filenm = projectid.ToString(); // string fileExt = System.IO.Path.GetExtension(FileUpload1.PostedFile.FileName); // BLProject BlObjGetDetails = new BLProject(); // if (Request.QueryString["ProjectId"] != null) // { // SqlDataReader dr2 = BlObjGetDetails.getProjectDetailsForUpdate1(projectid); // dr2.Read(); // //Split Mutiple files separated by comma and get last filename // if (dr2["filename"] != DBNull.Value) // { // string[] Files = Directory.GetFiles(dirPath, filenm + "*.*", SearchOption.AllDirectories); // int getFileCount = Files.Length; // filename = dr2.GetString(30); // values = filename.Split(','); // for (int i = 0; i < values.Length; i++) // { // values[i] = values[i].Trim(); // file = values[i]; // } // if (Session["filenew"] == null) // { // Session["filenew"] = filename; // } // } // else // { // string[] Files = Directory.GetFiles(dirPath, filenm + ".*", SearchOption.AllDirectories); // int getFileCount = Files.Length; // if (getFileCount == 0) // { // file = projectid.ToString(); // } // foreach (string f in Files) // { // if (f.Contains(filenm)) // { // file = Session["filenew"].ToString(); // suffix = 'a'; // } // else // { // file = projectid.ToString(); // } // } // } // dr2.Close(); // //Split Upto filename and . character // values = file.Split('.'); // for (int i = 0; i < values.Length; i++) // { // values[i] = values[i].Trim(); // file = values[i]; // break; // } // int length = file.Length; // suffix = file.Last(); // if (Char.IsDigit(suffix)) // { // suffix = 'a'; // } // } // strFileName = FileUpload1.PostedFile.FileName; // c = projectid.ToString() + fileExt; // string[] Files1 = Directory.GetFiles(dirPath, filenm + "*.*", SearchOption.AllDirectories); // int getFileCount1 = Files1.Length; // if (getFileCount1 == 0) // { // strFilePath = Server.MapPath("~\\Document\\" + c); // FileUpload1.SaveAs(Server.MapPath("~\\Document\\") + c); // filenew = c; // Session["file"] = filenew; // Session["filenew"] = filenew; // Session["strFilePath"] = strFilePath; // lblMessageFile.ForeColor = System.Drawing.Color.Green; // lblMessageFile.Text = c + " file Uploaded Sucessfully."; // lblFileuploadValue.Text = "1"; // } // else // { // if (Session["file"] != null) // { // file = Session["file"].ToString(); // } // if (Session["chars"] != null) // { // suffix = Convert.ToChar(Session["chars"]); // } // if (file.Contains(suffix)) // { // suffix++; // } // c = projectid.ToString() + suffix + fileExt; // Session["chars"] = suffix; // strFilePath = Session["strFilePath"].ToString() + "," + Server.MapPath("~\\Document\\" + c); // FileUpload1.SaveAs(Server.MapPath("~\\Document\\") + c); // if (Session["filenew"] != null) // { // filenew = Session["filenew"].ToString(); // } // if (Request.QueryString["ProjectId"] != null) // { // dpdwnlstFileNames.Items.Add(c); // //filenew = filename; // } // filenew = filenew + "," + c; // Session["file"] = c; // Session["filenew"] = filenew; // lblMessageFile.ForeColor = System.Drawing.Color.Green; // lblMessageFile.Text = c + " file Uploaded Sucessfully."; // lblFileuploadValue.Text = "1"; // } // Session["strFilePath"] = strFilePath; // Session["strFileName"] = filenew; // } // catch (Exception ex) // { // lblCatchError.Text = ex.Message.ToString(); // } // } protected void ddlTypWrk_SelectedIndexChanged(object sender, EventArgs e) { try { int intTypeOfWorkID = 0; BLProject blp = new BLProject(); string strWork = ddlTypWrk.SelectedItem.Text; SqlDataReader dr = blp.getTypWrkIdByWrk1(strWork); if (dr.HasRows) { dr.Read(); intTypeOfWorkID = dr.GetInt32(0); } dr.Close(); lblTypWrkID.Text = intTypeOfWorkID.ToString(); } catch (Exception ex) { lblCatchError.Text = ex.Message.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { try { if ((HttpContext.Current.Session["LoginId"]) == null) { Response.Redirect("~/Login.aspx"); } if (!Page.IsPostBack) { Session["strFileName"] = null; Session["strFilePath"] = null; Session["chars"] = null; Session["filenew"] = null; //cbpdf.Visible = false; #region------------fill DDLClient------------ BLProject blvc = new BLProject(); SqlDataReader dr = blvc.getClientNameForProject1(); ddlCliNm.Items.Clear(); if (dr.HasRows) { while (dr.Read()) ddlCliNm.Items.Add(dr.GetString(0)); ddlCliNm.Items.Insert(0, new ListItem("--Select--", "-1")); dr.Close(); } #endregion #region----------Fill DDLTypeofWork-------------- BLProject bltow = new BLProject(); SqlDataReader dr1 = bltow.getTypeOfWorkForProject1(); ddlTypWrk.Items.Clear(); if (dr1.HasRows) { while (dr1.Read()) ddlTypWrk.Items.Add(dr1.GetString(1)); ddlTypWrk.Items.Insert(0, new ListItem("--Select--", "-1")); dr1.Close(); } #endregion ddlStatus.Items.Insert(0, new ListItem("--Select--", "-1")); #region-----------All fillgrid function call-------------- fillgridClerk(); fillgridPapers(); fillgridEmployees(); fillgridDocBoy(); #endregion #region------------------Show values to date textboxces----------------- txtDate.Text = DateTime.Now.Date.ToShortDateString(); txtSoftCopySent.Text = DateTime.Now.Date.ToShortDateString(); txtPendingDocRcd.Text = DateTime.Now.Date.ToShortDateString(); txtHardCopySent.Text = DateTime.Now.Date.ToShortDateString(); //txtPendingDocRcsp.Text = DateTime.Now.Date.ToShortDateString(); txtSearchInitiated.Text = DateTime.Now.Date.ToShortDateString(); //txtFinalReportSent.Text = DateTime.Now.Date.ToShortDateString(); txtSearchReceived.Text = DateTime.Now.Date.ToShortDateString(); txtReceiptSearch.Text = DateTime.Now.Date.ToShortDateString(); txtStrDtEmp.Text = DateTime.Now.Date.ToShortDateString(); txtEndDtEmp.Text = DateTime.Now.Date.ToShortDateString(); txtStrStarDtClerk.Text = DateTime.Now.Date.ToShortDateString(); txtStrEndDtClerk.Text = DateTime.Now.Date.ToShortDateString(); #endregion if (Request.QueryString["ProjectId"] != null) { //dpdwnlstFileNames.Visible = true; lblProjectId.Text = Request.QueryString["ProjectId"].ToString(); int intProjectId = int.Parse(lblProjectId.Text); BLProject blc = new BLProject(); //btnOpenAddWrk.Enabled = true; //btnDelAddWrk.Enabled = true; //btnEmailAddWrk.Enabled = true; // Code to show selected Documents int gvdocid; //intProjectId = int.Parse(Session["ProjectId"].ToString()); SqlDataReader dr3 = blc.showSelectedDoc1(intProjectId); System.Data.DataTable dt = new System.Data.DataTable(); dt.Columns.Add("docid"); if (dr3.HasRows) { while (dr3.Read()) { int doc = dr3.GetInt32(0); dt.Rows.Add(doc); } dr3.Close(); } foreach (GridViewRow gvrow in GVPapers.Rows) { if (gvrow.RowType == DataControlRowType.DataRow) { System.Web.UI.WebControls.Label lblDocumentID = (gvrow.Cells[0].FindControl("lblDocumentId") as System.Web.UI.WebControls.Label); gvdocid = int.Parse(lblDocumentID.Text); System.Web.UI.WebControls.CheckBox chksel = (gvrow.Cells[0].FindControl("ChkBxSelDoc") as System.Web.UI.WebControls.CheckBox); for (int i = 0; i < dt.Rows.Count; i++) { int doc = int.Parse(dt.Rows[i].Field<string>(0)); if (doc == gvdocid) { chksel.Checked = true; } } } } //Code to show selected Employees int gvempid; // intProjectId = int.Parse(Session["ProjectId"].ToString()); SqlDataReader dr4 = blc.showSelectedEmployees1(intProjectId); System.Data.DataTable dt1 = new System.Data.DataTable(); dt1.Columns.Add("empid"); if (dr4.HasRows) { while (dr4.Read()) { int emp = dr4.GetInt32(0); dt1.Rows.Add(emp); } dr4.Close(); } foreach (GridViewRow gvrow in GVEmployees.Rows) { if (gvrow.RowType == DataControlRowType.DataRow) { System.Web.UI.WebControls.Label lblEmployeeID = (gvrow.Cells[0].FindControl("lblEmployeeID") as System.Web.UI.WebControls.Label); gvempid = Convert.ToInt32(lblEmployeeID.Text); System.Web.UI.WebControls.CheckBox chksel = (gvrow.Cells[0].FindControl("ChkBxSelEmp") as System.Web.UI.WebControls.CheckBox); for (int i = 0; i < dt1.Rows.Count; i++) { int emp = int.Parse(dt1.Rows[i].Field<string>(0)); if (emp == gvempid) { chksel.Checked = true; } } } } //Code To show Selected Document Boys int gvdocboyid; // intProjectId = int.Parse(Session["ProjectId"].ToString()); SqlDataReader dr5 = blc.showSelectedDocBoys1(intProjectId); System.Data.DataTable dt2 = new System.Data.DataTable(); dt2.Columns.Add("docboyid"); if (dr5.HasRows) { while (dr5.Read()) { int doc = dr5.GetInt32(0); dt2.Rows.Add(doc); } dr5.Close(); } foreach (GridViewRow gvrow in GVDocBoy.Rows) { if (gvrow.RowType == DataControlRowType.DataRow) { System.Web.UI.WebControls.Label lblDocumentBoyID = (gvrow.Cells[0].FindControl("lblDocumentBoyID") as System.Web.UI.WebControls.Label); gvdocboyid = int.Parse(lblDocumentBoyID.Text); System.Web.UI.WebControls.CheckBox chksel = (gvrow.Cells[0].FindControl("ChkBxSelDocBoy") as System.Web.UI.WebControls.CheckBox); for (int i = 0; i < dt2.Rows.Count; i++) { int docboy = int.Parse(dt2.Rows[i].Field<string>(0)); if (docboy == gvdocboyid) { chksel.Checked = true; } } } } //Code to show selected clerk int gvclerkid; //intProjectId = int.Parse(Session["ProjectId"].ToString()); SqlDataReader dr6 = blc.showSelectedClerk1(intProjectId); System.Data.DataTable dt3 = new System.Data.DataTable(); dt3.Columns.Add("clerkid"); if (dr6.HasRows) { while (dr6.Read()) { int clerk = dr6.GetInt32(0); dt3.Rows.Add(clerk); } } dr6.Close(); foreach (GridViewRow gvrow in GVClerk.Rows) { if (gvrow.RowType == DataControlRowType.DataRow) { System.Web.UI.WebControls.Label lblClerkID = (gvrow.Cells[0].FindControl("lblClerkID") as System.Web.UI.WebControls.Label); gvclerkid = int.Parse(lblClerkID.Text); System.Web.UI.WebControls.CheckBox chksel = (gvrow.Cells[0].FindControl("ChkBxSelClerk") as System.Web.UI.WebControls.CheckBox); for (int i = 0; i < dt3.Rows.Count; i++) { int clerk = int.Parse(dt3.Rows[i].Field<string>(0)); if (clerk == gvclerkid) { chksel.Checked = true; } } } } SqlDataReader dr2 = blc.getProjectDetailsForUpdate1(intProjectId); if (dr2.HasRows) { while (dr2.Read()) { Button1.Enabled = false; //btnSaveWordFile.Enabled = true; ddlCliNm.Enabled = false; ddlTypWrk.Enabled = false; //ddlStatus.Visible = false; txtDate.Text = dr2.GetDateTime(1).ToShortDateString(); ddlCliNm.SelectedValue = dr2.GetString(3); //code for fill grid of service BLServices blaee = new BLServices(); string strClientName1 = Convert.ToString(ddlCliNm.SelectedItem.Text); SqlDataReader dr8 = blaee.getClientIDforService1(strClientName1); if (dr8.HasRows) { while (dr8.Read()) lblCliId1.Text = dr8.GetInt32(0).ToString(); } dr8.Close(); int intClientID = int.Parse(lblCliId1.Text); BLServices blpr = new BLServices(); SqlDataReader dr9 = blpr.getServicePrice1(intClientID); System.Data.DataTable dt5 = new System.Data.DataTable(); if (dr9.HasRows) { dt5.Load(dr9); GVServices.DataSource = dt5; GVServices.DataBind(); } dr9.Close(); //Code to show selected Services int gvserviceid; // intProjectId = int.Parse(Session["ProjectId"].ToString()); SqlDataReader drService = blc.showSelectedServices1(intProjectId); System.Data.DataTable dtService = new System.Data.DataTable(); dtService.Columns.Add("serviceid"); if (drService.HasRows) { while (drService.Read()) { int service = drService.GetInt32(0); dtService.Rows.Add(service); } } drService.Close(); foreach (GridViewRow gvrow in GVServices.Rows) { if (gvrow.RowType == DataControlRowType.DataRow) { System.Web.UI.WebControls.Label lblSeviceID = (gvrow.Cells[0].FindControl("lblServiceID") as System.Web.UI.WebControls.Label); gvserviceid = int.Parse(lblSeviceID.Text); System.Web.UI.WebControls.CheckBox chksel = (gvrow.Cells[0].FindControl("ChkBxSelService") as System.Web.UI.WebControls.CheckBox); for (int i = 0; i < dtService.Rows.Count; i++) { int service = int.Parse(dtService.Rows[i].Field<string>(0)); if (service == gvserviceid) { chksel.Checked = true; } } } } lblTypWrkID.Text = dr2.GetInt32(4).ToString(); ddlTypWrk.SelectedValue = dr2.GetString(5); txtCasNm.Text = dr2.GetString(6); bool intExternalWork = dr2.GetBoolean(7); if (intExternalWork == true) chkBxDsReqExtWrk.Checked = true; else chkBxDsReqExtWrk.Checked = false; bool intNeedSearch = dr2.GetBoolean(8); if (intNeedSearch == true) chkBxDsReqSrch.Checked = true; else chkBxDsReqSrch.Checked = false; txtRemarks.Text = dr2.GetString(9); txtPrice.Text = dr2.GetDecimal(10).ToString(); txtOtherCharge.Text = dr2.GetDecimal(11).ToString(); txtTotAmt.Text = dr2.GetDecimal(12).ToString(); txtStatus.Text = dr2.GetString(13); ddlStatus.SelectedValue = dr2.GetString(13); bool intIsDeleted = dr2.GetBoolean(14); if (intIsDeleted == true) rbYesIsDel.Checked = true; else rbNoIsDel.Checked = true; int intApprove = dr2.GetInt32(15); if (intApprove == 1) ChkBxApprovProject.Checked = true; else ChkBxApprovProject.Checked = false; txtServiceTax.Text = dr2.GetDecimal(16).ToString(); txtRefNo.Text = dr2.GetString(17); if (dr2["LoanNo"] != DBNull.Value) { txtLoanAcNoAddWrk.Text = dr2.GetString(18); } else { txtLoanAcNoAddWrk.Text = ""; } if (dr2["PropertyAddress"] != DBNull.Value) { txtPropertyDetails.Text = dr2.GetString(19); } else { txtPropertyDetails.Text = ""; } if (dr2["dt_softcopysent"] != DBNull.Value) { txtSoftCopySent.Text = dr2.GetDateTime(20).ToShortDateString(); } else { txtSoftCopySent.Text = DateTime.Now.Date.ToShortDateString(); } DateTime dt_MISclient = Convert.ToDateTime("1990-01-01 00:00:00.000"); if (dr2["dt_search_initiated"] != DBNull.Value) { txtSearchInitiated.Text = dr2.GetDateTime(22).ToShortDateString(); } else { txtSearchInitiated.Text = DateTime.Now.Date.ToShortDateString(); } if (dr2["dt_search_received"] != DBNull.Value) { txtSearchReceived.Text = dr2.GetDateTime(23).ToShortDateString(); } else { txtSearchReceived.Text = DateTime.Now.Date.ToShortDateString(); } if (dr2["dt_search_received_receipt"] != DBNull.Value) { txtReceiptSearch.Text = dr2.GetDateTime(24).ToShortDateString(); } else { txtReceiptSearch.Text = DateTime.Now.Date.ToShortDateString(); } if (dr2["dt_hardcopysent"] != DBNull.Value) { txtHardCopySent.Text = dr2.GetDateTime(25).ToShortDateString(); } else { txtHardCopySent.Text = DateTime.Now.Date.ToShortDateString(); } if (dr2["dt_pendingdocumentsrec"] != DBNull.Value) { txtPendingDocRcd.Text = dr2.GetDateTime(26).ToShortDateString(); } else { txtPendingDocRcd.Text = DateTime.Now.Date.ToShortDateString(); } //if (dr2["dt_pendingdocumentsresp"] != DBNull.Value) //{ // txtPendingDocRcsp.Text = dr2.GetDateTime(27).ToShortDateString(); //} //else //{ // txtPendingDocRcsp.Text = DateTime.Now.Date.ToShortDateString(); //} //if (dr2["dt_finalreportsent"] != DBNull.Value) //{ // txtFinalReportSent.Text = dr2.GetDateTime(28).ToShortDateString(); //} //else //{ // txtPendingDocRcsp.Text = DateTime.Now.Date.ToShortDateString(); //} if (dr2["branch"] != DBNull.Value) { txtBranchAddWrk.Text = dr2.GetString(31); } else { txtBranchAddWrk.Text = ""; } //if (dr2["loanamt"] != DBNull.Value) //{ // txtLoanAmtAddWrk.Text = dr2.GetDecimal(32).ToString(); //} //else //{ // txtLoanAmtAddWrk.Text = ""; //} if (dr2["worddoc"] != DBNull.Value) { Byte[] strworddoc = (byte[])dr2["worddoc"]; str = System.Text.Encoding.Default.GetString(strworddoc); Session["strFilePath"] = str; } else { Session["strFilePath"] = null; } if (dr2["filename"] != DBNull.Value) { //string filename = dr2.GetString(30); //string[] values = filename.Split(','); //for (int i = 0; i < values.Length; i++) //{ // values[i] = values[i].Trim(); // filename = values[i]; // dpdwnlstFileNames.Items.Add(filename); //} //Session["strFileName"] = dr2.GetString(30); } else { Session["strFileName"] = null; } //TRy if (dr2["EmailID"] != DBNull.Value) { //txtEmail.Text = dr2.GetString(33); } } dr2.Close(); } } } else { //Span1.InnerHtml = ""; lblResult.Text = ""; lblCatchError.Text = ""; lbltesting.Text = ""; lblMessageFile.Text = ""; lblDelMsg.Text = ""; //CEDate.SelectedDate = DateTime.ParseExact(txtDate.Text, CEDate.Format, null); CalendarExtender9.SelectedDate = DateTime.ParseExact(txtStrDtEmp.Text, CalendarExtender9.Format, null); CalendarExtender10.SelectedDate = DateTime.ParseExact(txtEndDtEmp.Text, CalendarExtender10.Format, null); CalendarExtender11.SelectedDate = DateTime.ParseExact(txtStrStarDtClerk.Text, CalendarExtender11.Format, null); CalendarExtender12.SelectedDate = DateTime.ParseExact(txtStrEndDtClerk.Text, CalendarExtender12.Format, null); CalendarExtender1.SelectedDate = DateTime.ParseExact(txtSoftCopySent.Text, CalendarExtender1.Format, null); CalendarExtender2.SelectedDate = DateTime.ParseExact(txtPendingDocRcd.Text, CalendarExtender2.Format, null); CalendarExtender3.SelectedDate = DateTime.ParseExact(txtHardCopySent.Text, CalendarExtender3.Format, null); //CalendarExtender5.SelectedDate = DateTime.ParseExact(txtPendingDocRcsp.Text, CalendarExtender5.Format, null); CalendarExtender4.SelectedDate = DateTime.ParseExact(txtSearchInitiated.Text, CalendarExtender4.Format, null); //CalendarExtender6.SelectedDate = DateTime.ParseExact(txtFinalReportSent.Text, CalendarExtender6.Format, null); CalendarExtender7.SelectedDate = DateTime.ParseExact(txtSearchReceived.Text, CalendarExtender7.Format, null); CalendarExtender8.SelectedDate = DateTime.ParseExact(txtReceiptSearch.Text, CalendarExtender8.Format, null); } } catch (Exception ex) { lblCatchError.Text = ex.Message.ToString(); } }
protected void AddSelectedRecords(int intProjectId) { try { BLProject blp = new BLProject(); //Data Table for save Selected Documents and delete unselected document int intProjectId1 = intProjectId; System.Data.DataTable dtSelDocument = new System.Data.DataTable(); System.Data.DataTable dtUnSelDocument = new System.Data.DataTable(); dtSelDocument.Columns.AddRange(new DataColumn[1] { new DataColumn("Docid") }); dtSelDocument.Columns.AddRange(new DataColumn[1] { new DataColumn("Document") }); dtUnSelDocument.Columns.AddRange(new DataColumn[1] { new DataColumn("Docid") }); foreach (GridViewRow gvrow in GVPapers.Rows) { if (gvrow.RowType == DataControlRowType.DataRow) { //finding the checkbox in the gridview System.Web.UI.WebControls.CheckBox ChkBxSelDoc = (gvrow.Cells[0].FindControl("ChkBxSelDoc") as System.Web.UI.WebControls.CheckBox); System.Web.UI.WebControls.Label lblDocId = (gvrow.Cells[0].FindControl("lblDocumentId") as System.Web.UI.WebControls.Label); System.Web.UI.WebControls.Label lblDocName = (gvrow.Cells[0].FindControl("lblDocumentName") as System.Web.UI.WebControls.Label); // checking which checkbox are selected if (ChkBxSelDoc.Checked) { int Docid = int.Parse(lblDocId.Text); string Document = lblDocName.Text; dtSelDocument.Rows.Add(Docid, Document); } else { int Docid = int.Parse(lblDocId.Text); dtUnSelDocument.Rows.Add(Docid); } } } // System.Data.DataTable dt = (System.Data.DataTable)dtSelDocument; for (int i = 0; i < dtSelDocument.Rows.Count; i++) { int docid = int.Parse(dtSelDocument.Rows[i].Field<string>(0)); string document = dtSelDocument.Rows[i].Field<string>(1); blp.saveSelectedDoc1(intProjectId, docid, document); } for (int i = 0; i < dtUnSelDocument.Rows.Count; i++) { int docid = int.Parse(dtUnSelDocument.Rows[i].Field<string>(0)); blp.delUnSelectDoc1(intProjectId, docid); } // Data Table for save Selected Employees and delete unselected employee System.Data.DataTable dtSelEmployee = new System.Data.DataTable(); System.Data.DataTable dtUnSelEmployee = new System.Data.DataTable(); dtSelEmployee.Columns.AddRange(new DataColumn[1] { new DataColumn("Empid") }); dtSelEmployee.Columns.AddRange(new DataColumn[1] { new DataColumn("EmpCode") }); dtSelEmployee.Columns.AddRange(new DataColumn[1] { new DataColumn("StartDt") }); dtSelEmployee.Columns.AddRange(new DataColumn[1] { new DataColumn("EndDt") }); dtUnSelEmployee.Columns.AddRange(new DataColumn[1] { new DataColumn("Empid") }); foreach (GridViewRow gvrow in GVEmployees.Rows) { if (gvrow.RowType == DataControlRowType.DataRow) { //finding the checkbox in the gridview System.Web.UI.WebControls.CheckBox ChkBxSelEmp = (gvrow.Cells[0].FindControl("ChkBxSelEmp") as System.Web.UI.WebControls.CheckBox); System.Web.UI.WebControls.Label lblEmployeeID = (gvrow.Cells[0].FindControl("lblEmployeeID") as System.Web.UI.WebControls.Label); System.Web.UI.WebControls.Label lblEmployeeCode = (gvrow.Cells[0].FindControl("lblEmployeeCode") as System.Web.UI.WebControls.Label); // checking which checkbox are selected if (ChkBxSelEmp.Checked) { int Empid = int.Parse(lblEmployeeID.Text); string EmpCode = lblEmployeeCode.Text; DateTime StartDt = DateTime.Parse(txtStrDtEmp.Text); DateTime EndDt = DateTime.Parse(txtEndDtEmp.Text); dtSelEmployee.Rows.Add(Empid, EmpCode, StartDt, EndDt); } else { int Empid = int.Parse(lblEmployeeID.Text); dtUnSelEmployee.Rows.Add(Empid); } } } //System.Data.DataTable dt1 = (System.Data.DataTable)dtSelEmployee; for (int i = 0; i < dtSelEmployee.Rows.Count; i++) { string EmpCode = dtSelEmployee.Rows[i].Field<string>(1); DateTime StartDt = Convert.ToDateTime(dtSelEmployee.Rows[i].Field<string>(2)); DateTime EndDt = Convert.ToDateTime(dtSelEmployee.Rows[i].Field<string>(3)); int intEmployeeID = int.Parse(dtSelEmployee.Rows[i].Field<string>(0)); string strEmployeeName = EmpCode; blp.saveSelectedEmp1(intProjectId, intEmployeeID, strEmployeeName, StartDt, EndDt); } for (int i = 0; i < dtUnSelEmployee.Rows.Count; i++) { int empid = int.Parse(dtUnSelEmployee.Rows[i].Field<string>(0)); blp.delUnSelectedEmp1(intProjectId, empid); } // Data Table for Selected save Clerk and delete unselected clerk System.Data.DataTable dtSelClerk = new System.Data.DataTable(); System.Data.DataTable dtUnSelClerk = new System.Data.DataTable(); dtSelClerk.Columns.AddRange(new DataColumn[1] { new DataColumn("Clerkid") }); dtSelClerk.Columns.AddRange(new DataColumn[1] { new DataColumn("ClerkName") }); dtSelClerk.Columns.AddRange(new DataColumn[1] { new DataColumn("StartDt") }); dtSelClerk.Columns.AddRange(new DataColumn[1] { new DataColumn("EndDt") }); dtUnSelClerk.Columns.AddRange(new DataColumn[1] { new DataColumn("Clerkid") }); foreach (GridViewRow gvrow in GVClerk.Rows) { if (gvrow.RowType == DataControlRowType.DataRow) { //finding the checkbox in the gridview System.Web.UI.WebControls.CheckBox ChkBxSelClerk = (gvrow.Cells[0].FindControl("ChkBxSelClerk") as System.Web.UI.WebControls.CheckBox); System.Web.UI.WebControls.Label lblClerkID = (gvrow.Cells[0].FindControl("lblClerkID") as System.Web.UI.WebControls.Label); System.Web.UI.WebControls.Label lblClerkName = (gvrow.Cells[0].FindControl("lblClerkName") as System.Web.UI.WebControls.Label); // checking which checkbox are selected if (ChkBxSelClerk.Checked) { int Clerkid = int.Parse(lblClerkID.Text); string ClerkName = lblClerkName.Text; DateTime StartDt = DateTime.Parse(txtStrStarDtClerk.Text); DateTime EndDt = DateTime.Parse(txtStrEndDtClerk.Text); dtSelClerk.Rows.Add(Clerkid, ClerkName, StartDt, EndDt); } else { int Clerkid = int.Parse(lblClerkID.Text); dtUnSelClerk.Rows.Add(Clerkid); } } } //System.Data.DataTable dt4 = (System.Data.DataTable)dtSelClerk; for (int i = 0; i < dtSelClerk.Rows.Count; i++) { int Clerkid = int.Parse(dtSelClerk.Rows[i].Field<string>(0)); string ClerkName = dtSelClerk.Rows[i].Field<string>(1); DateTime StartDt = Convert.ToDateTime(dtSelClerk.Rows[i].Field<string>(2)); DateTime EndDt = Convert.ToDateTime(dtSelClerk.Rows[i].Field<string>(3)); blp.saveSelectedClerk1(intProjectId, Clerkid, ClerkName, StartDt, EndDt); } for (int i = 0; i < dtUnSelClerk.Rows.Count; i++) { int Clerkid = int.Parse(dtUnSelClerk.Rows[i].Field<string>(0)); blp.delUnselectClerk1(intProjectId, Clerkid); } //Data Table for save Selected Services and delete unselected service System.Data.DataTable dtSelService = new System.Data.DataTable(); System.Data.DataTable dtUnSelService = new System.Data.DataTable(); dtSelService.Columns.AddRange(new DataColumn[1] { new DataColumn("Serviceid") }); dtSelService.Columns.AddRange(new DataColumn[1] { new DataColumn("Service") }); dtSelService.Columns.AddRange(new DataColumn[1] { new DataColumn("Price") }); dtUnSelService.Columns.AddRange(new DataColumn[1] { new DataColumn("Serviceid") }); foreach (GridViewRow gvrow in GVServices.Rows) { if (gvrow.RowType == DataControlRowType.DataRow) { //finding the checkbox in the gridview System.Web.UI.WebControls.CheckBox ChkBxSelService = (gvrow.Cells[0].FindControl("ChkBxSelService") as System.Web.UI.WebControls.CheckBox); System.Web.UI.WebControls.Label lblServiceID = (gvrow.Cells[0].FindControl("lblServiceID") as System.Web.UI.WebControls.Label); System.Web.UI.WebControls.Label lblServiceName = (gvrow.Cells[0].FindControl("lblServiceName") as System.Web.UI.WebControls.Label); System.Web.UI.WebControls.Label lblServicePrice = (gvrow.Cells[0].FindControl("lblServicePrice") as System.Web.UI.WebControls.Label); // checking which checkbox are selected if (ChkBxSelService.Checked) { int Serviceid = int.Parse(lblServiceID.Text); string Service = lblServiceName.Text; decimal Price = decimal.Parse(lblServicePrice.Text); dtSelService.Rows.Add(Serviceid, Service, Price); } else { int Serviceid = int.Parse(lblServiceID.Text); dtUnSelService.Rows.Add(Serviceid); } } } for (int i = 0; i < dtSelService.Rows.Count; i++) { int Serviceid = int.Parse(dtSelService.Rows[i].Field<string>(0)); string Service = dtSelService.Rows[i].Field<string>(1); float flotPrice = float.Parse(dtSelService.Rows[i].Field<string>(2)); blp.saveSelectedServices1(intProjectId, Serviceid, Service, flotPrice); } for (int i = 0; i < dtUnSelService.Rows.Count; i++) { int Serviceid = int.Parse(dtUnSelService.Rows[i].Field<string>(0)); blp.delUnSelectedServices1(intProjectId, Serviceid); } //Data Table for save Selected DocumentBoys and delete unselected Document boy System.Data.DataTable dtSelDocumentBoy = new System.Data.DataTable(); System.Data.DataTable dtUnSelDocumentBoy = new System.Data.DataTable(); dtSelDocumentBoy.Columns.AddRange(new DataColumn[1] { new DataColumn("DocBoyid") }); dtSelDocumentBoy.Columns.AddRange(new DataColumn[1] { new DataColumn("DocumentBoy") }); dtUnSelDocumentBoy.Columns.AddRange(new DataColumn[1] { new DataColumn("DocBoyid") }); foreach (GridViewRow gvrow in GVDocBoy.Rows) { if (gvrow.RowType == DataControlRowType.DataRow) { //finding the checkbox in the gridview System.Web.UI.WebControls.CheckBox ChkBxSelDocBoy = (gvrow.Cells[0].FindControl("ChkBxSelDocBoy") as System.Web.UI.WebControls.CheckBox); System.Web.UI.WebControls.Label lblDocumentBoyID = (gvrow.Cells[0].FindControl("lblDocumentBoyID") as System.Web.UI.WebControls.Label); System.Web.UI.WebControls.Label lblDocumentBoyName = (gvrow.Cells[0].FindControl("lblDocumentBoyName") as System.Web.UI.WebControls.Label); // checking which checkbox are selected if (ChkBxSelDocBoy.Checked) { int DocBoyid = int.Parse(lblDocumentBoyID.Text); string DocumentBoy = lblDocumentBoyName.Text; dtSelDocumentBoy.Rows.Add(DocBoyid, DocumentBoy); } else { int DocBoyid = int.Parse(lblDocumentBoyID.Text); dtUnSelDocumentBoy.Rows.Add(DocBoyid); } } } for (int i = 0; i < dtSelDocumentBoy.Rows.Count; i++) { int DocBoyid = int.Parse(dtSelDocumentBoy.Rows[i].Field<string>(0)); string DocBoy = dtSelDocumentBoy.Rows[i].Field<string>(1); blp.saveSelectedDocumentBoy1(intProjectId, DocBoyid, DocBoy); } for (int i = 0; i < dtUnSelDocumentBoy.Rows.Count; i++) { int DocBoyid = int.Parse(dtUnSelDocumentBoy.Rows[i].Field<string>(0)); blp.delUnSelectedDocBoy1(intProjectId, DocBoyid); } } catch (Exception ex) { lblCatchError.Text = ex.Message.ToString(); } }
protected void btnDeleteSelectedProject_Click(object sender, EventArgs e) { try { foreach (GridViewRow gvrow in GdVwSrchProjects.Rows) { if (gvrow.RowType == DataControlRowType.DataRow) { //finding the checkbox in the gridview CheckBox ChkBxSelProject = (gvrow.Cells[0].FindControl("ChkBxSelProject") as CheckBox); // checking which checkbox are selected if (ChkBxSelProject.Checked) { int ProjectID = int.Parse(gvrow.Cells[3].Text); BLProject objBLProject = new BLProject(); objBLProject.deleteProject(ProjectID); lblmsg.Text = "Project(s) Deleted."; } } } } catch (Exception ex) { lblCatchError.Text = ex.Message.ToString(); } }
protected int getMaxProjectId() { try { BLProject blp = new BLProject(); SqlDataReader dr = blp.getMaxProjectId1(); if (dr.HasRows) { dr.Read(); lblMaxPrjId.Text = Convert.ToString(dr.GetInt32(0)); projectid = int.Parse(lblMaxPrjId.Text); projectid++; dr.Close(); } return projectid; } catch (Exception ex) { lblCatchError.Text = ex.Message.ToString(); } return projectid; }
private void GetCaseData(BLProject blvc, string strClientName) { SqlDataReader dr1 = blvc.getCaseName1(strClientName); ddlCasNmPrj.Items.Add("--Select--"); if (dr1.HasRows == true) { while (dr1.Read()) ddlCasNmPrj.Items.Add(dr1.GetString(0)); } else { lblError.Text = "Records not available"; } }
private void GetClientData(BLProject blvc) { SqlDataReader dr = blvc.getClientName1(); ddlCliNmPrj.Items.Add("--Select--"); if (dr.HasRows == true) { while (dr.Read()) ddlCliNmPrj.Items.Add(dr.GetString(0)); } else { lblError.Text = "Records not available"; } }
protected void GdVwSrchProjects_RowCommand(object sender, GridViewCommandEventArgs e) { try { if (e.CommandName == "Edit") { GridViewRow gvr = (GridViewRow)((Control)e.CommandSource).NamingContainer; int rowIndex = gvr.RowIndex; int ProjectId = Convert.ToInt32(GdVwSrchProjects.Rows[rowIndex].Cells[3].Text); Session["ProjectId"] = ProjectId.ToString(); Response.Redirect("~/Admin/Project/AddEditWork.aspx?ProjectId=" + ProjectId); } if (e.CommandName == "Delete") { GridViewRow gvr = (GridViewRow)((Control)e.CommandSource).NamingContainer; int rowIndex = gvr.RowIndex; int ProjectId = Convert.ToInt32(GdVwSrchProjects.Rows[rowIndex].Cells[3].Text); BLProject objBLProject = new BLProject(); objBLProject.deleteProject(ProjectId); lblmsg.Text = "Project(s) Deleted."; } } catch (Exception ex) { lblCatchError.Text = ex.Message.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { try { if ((HttpContext.Current.Session["LoginId"]) == null) { Response.Redirect("~/Login.aspx"); } if (!Page.IsPostBack) { BLProject blvc = new BLProject(); GetClientData(blvc); string strClientName = ""; GetCaseData(blvc, strClientName); //fillgrid(); this.GetCustomersPageWise(1); } else { lblmsg.Text = ""; lblError.Text = ""; lblCatchError.Text = ""; } } catch (Exception ex) { lblCatchError.Text = ex.Message.ToString(); } }
protected void btnSave_Click(object sender, EventArgs e) { try { BLDocBoyHistory bldb = new BLDocBoyHistory(); setparameters(); if (Session["DBHID"] != null) { int intDBHID = int.Parse(Session["DBHID"].ToString()); int intDBID = getDocBoyID(); bldb.updateDocBoyHistory1(intProjectID, dtDate, intDBID, strDocumentBoy, strRemarks, intDBHID); lblErrorMsg.Text = ""; Session["DBHID"] = null; lblresult.Visible = true; lblresult.Text = "Document Boy history Successfully updated"; } else { int intDBID = getDocBoyID(); // intDBID = int.Parse(lblId.Text); bldb.saveDocumentBoyHistory1(dtDate, intDBID, strDocumentBoy, strRemarks, intProjectID); lblErrorMsg.Text = ""; Session["DBHID"] = null; lblresult.Visible = true; lblresult.Text = "Document Boy history Successfully added"; } lblId.Text = ""; lblCode.Text = ""; txtRemarks.Text = ""; string strName1 = ddlSelDocBoy.SelectedItem.Text; int intProjectId = int.Parse(lblPrjId.Text); SqlDataReader dr1 = bldb.getDocBoyhistoryId1(strName1, intProjectId); if (dr1.HasRows) { while (dr1.Read()) { intDBHID = dr1.GetInt32(0); } dr1.Close(); } //Data Table to get Selected Documents and insert record into document boy history details BLDocBoyHistory bldbh = new BLDocBoyHistory(); BLProject blp = new BLProject(); DataTable dtSelDocument = new DataTable(); DataTable dtUnSelDocument = new DataTable(); dtSelDocument.Columns.AddRange(new DataColumn[1] { new DataColumn("Docid") }); dtSelDocument.Columns.AddRange(new DataColumn[1] { new DataColumn("Document") }); dtUnSelDocument.Columns.AddRange(new DataColumn[1] { new DataColumn("Docid") }); dtUnSelDocument.Columns.AddRange(new DataColumn[1] { new DataColumn("Document") }); foreach (GridViewRow gvrow in GVSelPendingDoc.Rows) { if (gvrow.RowType == DataControlRowType.DataRow) { //finding the checkbox in the gridview CheckBox ChkBxSelDoc = (gvrow.Cells[0].FindControl("ChkBxSelDoc") as CheckBox); // checking which checkbox are selected if (ChkBxSelDoc.Checked) { int docid = int.Parse(gvrow.Cells[1].Text); string Doc = gvrow.Cells[2].Text; dtSelDocument.Rows.Add(docid, Doc); } else { string Docid = gvrow.Cells[1].Text; string Doc = gvrow.Cells[2].Text; dtUnSelDocument.Rows.Add(Docid, Doc); } } } //DataTable dt = (DataTable)dtSelDocument; for (int i = 0; i < dtSelDocument.Rows.Count; i++) { int docid = int.Parse(dtSelDocument.Rows[i].Field<string>(0)); string doc = dtSelDocument.Rows[i].Field<string>(1); bldb.saveDocBoyHistoryDetails1(intDBHID, docid, doc); Session["DBHID"] = null; lblresult1.Visible = true; lblresult1.Text = "Document Boy history details Successfully added"; } for (int i = 0; i < dtUnSelDocument.Rows.Count; i++) { int docid = int.Parse(dtUnSelDocument.Rows[i].Field<string>(0)); bldbh.delUnselectedDocOfDocBoy1(intDBHID, docid); } if (dtUnSelDocument != null) { GVSelPendingDoc.DataSource = dtUnSelDocument; GVSelPendingDoc.DataBind(); } //show grid for document boy history details fillgridDocBoyHistoryDetails(); //lblresult.Text = "Exist"; } catch (Exception ex) { lblCatchError.Text = ex.Message.ToString(); } }
protected void GdVwSrchProjects_RowCommand(object sender, GridViewCommandEventArgs e) { try { if (e.CommandName == "Edit") { GridViewRow gvr = (GridViewRow)((System.Web.UI.Control)e.CommandSource).NamingContainer; int rowIndex = gvr.RowIndex; System.Web.UI.WebControls.Label lblProjectID = (gvr.Cells[0].FindControl("lblProjectID") as System.Web.UI.WebControls.Label); int ProjectId = Convert.ToInt32(lblProjectID.Text); Session["ProjectId"] = ProjectId.ToString(); Response.Redirect("~/Emp/Project/AddEditWork.aspx?ProjectId=" + ProjectId); } if (e.CommandName == "Delete") { GridViewRow gvr = (GridViewRow)((System.Web.UI.Control)e.CommandSource).NamingContainer; int rowIndex = gvr.RowIndex; System.Web.UI.WebControls.Label lblProjectID = (gvr.Cells[0].FindControl("lblProjectID") as System.Web.UI.WebControls.Label); int ProjectId = Convert.ToInt32(lblProjectID.Text); BLProject objBLProject = new BLProject(); objBLProject.deleteProject(ProjectId); lblUPDelete.Text = "Project(s) Deleted."; lblViewProjectDelete.Text = "Project(s) Deleted."; string message = "Hello! Mudassar."; System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("<script type = 'text/javascript'>"); sb.Append("window.onload=function(){"); sb.Append("alert('"); sb.Append(message); sb.Append("')};"); sb.Append("</script>"); ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString()); string strmsg = "<SCRIPT LANGUAGE="+"JavaScript"+">alert("+"Project Deleted"+")</SCRIPT>"; System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE=" + "JavaScript" + ">alert(" + "Project Deleted" + ")</SCRIPT>"); //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Project Deleted Successfully')", true); //ClientScript.RegisterStartupScript(typeof(string), "s", "alert(Project(s) Deleted);", true); // MessageBox.Show("Project(s) Deleted."); GdVwSrchProjects.DataSource = null; GdVwSrchProjects.DataBind(); } } catch (Exception ex) { lblCatchError.Text = ex.Message.ToString(); } }
protected void FileUpload(int projectid) { try { string dirPath = Server.MapPath("~/Document/"); string filenm = projectid.ToString(); string fileExt = System.IO.Path.GetExtension(FileUpload1.PostedFile.FileName); BLProject BlObjGetDetails = new BLProject(); if (Request.QueryString["ProjectId"] != null) { SqlDataReader dr2 = BlObjGetDetails.getProjectDetailsForUpdate1(projectid); dr2.Read(); //Split Mutiple files separated by comma and get last filename if (dr2["filename"] != DBNull.Value) { string[] Files = Directory.GetFiles(dirPath, filenm + "*.*", SearchOption.AllDirectories); int getFileCount = Files.Length; filename = dr2.GetString(30); values = filename.Split(','); for (int i = 0; i < values.Length; i++) { values[i] = values[i].Trim(); file = values[i]; } if (Session["filenew"] == null) { Session["filenew"] = filename; } } else { string[] Files = Directory.GetFiles(dirPath, filenm + ".*", SearchOption.AllDirectories); int getFileCount = Files.Length; if (getFileCount == 0) { file = projectid.ToString(); } foreach (string f in Files) { if (f.Contains(filenm)) { file = Session["filenew"].ToString(); suffix = 'a'; } else { file = projectid.ToString(); } } } dr2.Close(); //Split Upto filename and . character values = file.Split('.'); for (int i = 0; i < values.Length; i++) { values[i] = values[i].Trim(); file = values[i]; break; } int length = file.Length; suffix = file.Last(); if (Char.IsDigit(suffix)) { suffix = 'a'; } } strFileName = FileUpload1.PostedFile.FileName; c = projectid.ToString() + fileExt; string[] Files1 = Directory.GetFiles(dirPath, filenm + "*.*", SearchOption.AllDirectories); int getFileCount1 = Files1.Length; if (getFileCount1 == 0) { strFilePath = Server.MapPath("~\\Document\\" + c); FileUpload1.SaveAs(Server.MapPath("~\\Document\\") + c); filenew = c; Session["file"] = filenew; Session["filenew"] = filenew; Session["strFilePath"] = strFilePath; lblMessageFile.ForeColor = System.Drawing.Color.Green; lblMessageFile.Text = c + " file Uploaded Sucessfully."; lblFileuploadValue.Text = "1"; } else { if (Session["file"] != null) { file = Session["file"].ToString(); } if (Session["chars"] != null) { suffix = Convert.ToChar(Session["chars"]); } if (file.Contains(suffix)) { suffix++; } c = projectid.ToString() + suffix + fileExt; Session["chars"] = suffix; strFilePath = Session["strFilePath"].ToString() + "," + Server.MapPath("~\\Document\\" + c); FileUpload1.SaveAs(Server.MapPath("~\\Document\\") + c); if (Session["filenew"] != null) { filenew = Session["filenew"].ToString(); } if (Request.QueryString["ProjectId"] != null) { dpdwnlstFileNames.Items.Add(c); //filenew = filename; } filenew = filenew + "," + c; Session["file"] = c; Session["filenew"] = filenew; lblMessageFile.ForeColor = System.Drawing.Color.Green; lblMessageFile.Text = c + " file Uploaded Sucessfully."; lblFileuploadValue.Text = "1"; } Session["strFilePath"] = strFilePath; Session["strFileName"] = filenew; } catch (Exception ex) { lblCatchError.Text = ex.Message.ToString(); } }
protected void btnEmailAddWrk_Click(object sender, EventArgs e) { try { string file_name = dpdwnlstFileNames.SelectedItem.Text; Session["strFileNM"] = file_name; string MailID = ""; string UserName = ""; int LoginId = Convert.ToInt32(Session["LoginId"].ToString()); BLProject bl = new BLProject(); SqlDataReader dr = bl.GetData(LoginId); if (dr.Read()) { if (dr["MailID"] != DBNull.Value) { MailID = dr.GetString(0); UserName = dr.GetString(1); } else { lblResult.Text = "Database email id field is null"; } } Session["UserName"] = UserName; Session["Mail"] = MailID; Session["clientName"] = ddlCliNm.SelectedItem.Text; Session["caseName"] = txtCasNm.Text; if (txtLoanAcNoAddWrk.Text != "") { Session["LoanAcNo"] = txtLoanAcNoAddWrk.Text; } if (txtBranchAddWrk.Text != "") { Session["Branch"] = txtBranchAddWrk.Text; } if (txtLoanAmtAddWrk.Text != "") { Session["LoanAmmt"] = txtLoanAmtAddWrk.Text; } if (txtPropertyDetails.Text != "") { Session["Property"] = txtPropertyDetails.Text; } if (txtRemarks.Text != "") { Session["Remarks"] = txtRemarks.Text; } Response.Redirect("~/Admin/Mail/SendMail.aspx"); } catch (Exception ex) { lblCatchError.Text = ex.Message.ToString(); } }
protected void btnDelAddWrk_Click(object sender, EventArgs e) { try { string strfile; BLProject blp = new BLProject(); string filename, strConcatfile = "", filePath = "", strConFilePath = "", deleteallfile, filenew = ""; DialogResult result = MessageBox.Show("Are You sure to Delete Document"); //string strfile = Session["strFileName"].ToString(); strfile = dpdwnlstFileNames.SelectedItem.Text; filename = Session["strFileName"].ToString(); filePath = Session["strFilePath"].ToString(); SqlDataReader dr2 = BLObj.getProjectDetailsForUpdate1(projectid); dr2.Read(); //Split Mutiple files separated by comma and get last filename string[] values = filename.Split(','); for (int i = 0; i < values.Length; i++) { values[i] = values[i].Trim(); filename = values[i]; if (filename != strfile) { //if (i == values.Length ) //{ // strConcatfile=filename //} strConcatfile = strConcatfile + "," + filename; } } strConcatfile = strConcatfile.TrimStart(','); string path = Server.MapPath("~/Document/") + strfile; values = filePath.Split(','); for (int i = 0; i < values.Length; i++) { values[i] = values[i].Trim(); filePath = values[i]; if (filePath != path) { strConFilePath = strConFilePath + "," + filePath; } } strConFilePath = strConFilePath.TrimStart(','); if (Request.QueryString["ProjectId"] != null) { projectid = int.Parse(Request.QueryString["ProjectId"]); } deleteallfile = projectid.ToString(); FileInfo file = new FileInfo(path); string dirPath = Server.MapPath("~/Document/"); if (result == DialogResult.OK) { if (Session["strFilePath"].ToString() != null && Session["strFileName"].ToString() != null) { if (file.Exists) { file.Delete(); lblDelMsg.Visible = true; lblDelMsg.Text = strfile + " file deleted successfully"; string msg = blp.UpadateFileDelete(projectid, strConFilePath, strConcatfile); string[] Files = Directory.GetFiles(dirPath, deleteallfile + "*.*", SearchOption.AllDirectories); int getFileCount = Files.Length; if (getFileCount == 0) { blp.delDocOnProject1(projectid); } dr2 = BLObj.getProjectDetailsForUpdate1(projectid); dr2.Read(); if (dr2["filename"] != DBNull.Value) { filenew = dr2.GetString(30); } if (dr2["worddoc"] != DBNull.Value) { Byte[] strworddoc = (byte[])dr2["worddoc"]; str = System.Text.Encoding.Default.GetString(strworddoc); } Session["strFileName"] = filenew; Session["strFilePath"] = str; //txtFileName.Text = ""; } else { lblDelMsg.Visible = true; lblDelMsg.Text = strfile + " file not exist"; } } int i = dpdwnlstFileNames.Items.Count; for (int j = 0; j < i; j++) { if (dpdwnlstFileNames.Items[j].Selected == true) { dpdwnlstFileNames.Items.Remove(dpdwnlstFileNames.Items[j].ToString()); i--; } } Session["file"] = strConcatfile; } } catch (Exception ex) { lblCatchError.Text = ex.Message.ToString(); } }