protected void btnAssignandClose_Click(object sender, EventArgs e) { SaveItemsSelection(); DataTable dtInpectionSchedule = (DataTable)ViewState["vsdtSelected_Items"]; if (dtInpectionSchedule.Rows.Count == 0) { objInsp.Save_InspectionWorklistWithNodeVal(dtInpectionSchedule, UDFLib.ConvertToInteger(ViewState["InspectionID"]), UDFLib.ConvertIntegerToNull(ViewState["SubCatCode"]), UDFLib.ConvertIntegerToNull(ViewState["LocationNodeID"]), Convert.ToInt32(Session["USERID"])); } else { if (Request.QueryString["LocationNodeID"] == null) { DataRow[] dr = dtInpectionSchedule.Select("LocationNodeID = null or LocationNodeID = 0"); DataTable dt = dr.CopyToDataTable(); objInsp.Save_InspectionWorklistWithNodeVal(dt, null, null, null, Convert.ToInt32(Session["USERID"])); } else { objInsp.Save_InspectionWorklistWithNodeVal(dtInpectionSchedule, null, null, null, Convert.ToInt32(Session["USERID"])); } string sPath = Server.MapPath("\\" + System.Configuration.ConfigurationManager.AppSettings["APP_NAME"].ToString() + "\\uploads\\Technical"); string sPath1 = Server.MapPath("\\" + System.Configuration.ConfigurationManager.AppSettings["APP_NAME"].ToString() + "\\uploads\\Inspection"); DataTable dtAttachments = objInsp.Get_ImagePath(dtInpectionSchedule); if (dtAttachments.Rows.Count > 0) { for (int i = 0; i < dtAttachments.Rows.Count; i++) { string FilePath = Path.Combine(sPath, Path.GetFileName(dtAttachments.Rows[i]["ATTACH_PATH"].ToString())); if (!File.Exists(Path.Combine(sPath1, Path.GetFileName(dtAttachments.Rows[i]["ATTACH_PATH"].ToString())))) { File.Copy(FilePath, Path.Combine(sPath1, Path.GetFileName(dtAttachments.Rows[i]["ATTACH_PATH"].ToString())), true); } } } } string js; if (grdJoblist.Rows.Count > 0) { js = "alert('Worklist Assigned Successfully!');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "alertjs", js, true); } js = "parent.saveCloseChild();"; ScriptManager.RegisterStartupScript(this, this.GetType(), "hideModalJS", js, true); int attachJobsCount = dtInpectionSchedule.Rows.Count; //Request.QueryString["ControlID"]; js = "parent.updateJobCounts('" + Request.QueryString["ControlID"] + "','" + attachJobsCount + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "updateJobCount", js, true); }