protected void btnSaveSettings_Click(object sender, EventArgs e) { try { string sml_status = WebTools.GetExpr("CURRENT_STATUS", "PROJECT_JOB_LIST", " WHERE PROCESS_NAME = '" + process_name + "'"); if (sml_status.Equals("RUNNING")) { Master.ShowWarn("Simulation Already Running. Please Try Again Later."); return; } sml_status = WebTools.CountExpr("STATUS", "SIMULATION_HEADER", " WHERE STATUS = 'PR'"); if (!sml_status.Equals("0")) { Master.ShowWarn("Simulation Already Running. Please Try Again Later."); return; } string message = set_current_page_settings(); Master.ShowSuccess(message); } catch (Exception ex) { Master.ShowWarn(ex.Message); } }
protected void btnRunSimulation_Click(object sender, EventArgs e) { if (CollectSubCons()) { if (sml_status.Equals("RUNNING")) { Master.ShowWarn("Ooops... Simulation is already running !!!"); return; } btnSaveSettings_Click(sender, e); try { //CHECK status of //1. PO link //2. Line MTO simulation //3. Updae server status //if not running then proceed string po_status = "", any_update_running = ""; po_status = WebTools.GetExpr("CURRENT_STATUS", "PROJECT_JOB_LIST", "PROCESS_NAME='IMPORT_PO_DATA'"); any_update_running = WebTools.CountExpr("PROCESS_NAME", "PROJECT_JOB_LIST", "PROCESS_GROUP='SERVER_UPDATE' AND CURRENT_STATUS='RUNNING'"); //If IDF simulation and PO, both are completed if (!po_status.Equals("RUNNING") && any_update_running.Equals("0")) { string sql = ""; WebTools.ExeSql("UPDATE PROJECT_JOB_LIST SET CURRENT_STATUS='RUNNING' WHERE PROCESS_NAME='SITE_SIMULATION'"); sql = WebTools.GetExpr("SQL_TO_RUN", "PROJECT_JOB_LIST", " PROCESS_NAME='SITE_SIMULATION'"); WebTools.ExeSql(sql); Master.ShowSuccess("You request for Site simulation has started !!!"); } //If bom simulation is not running else { WebTools.ExeSql("UPDATE PROJECT_JOB_LIST SET CURRENT_STATUS='REQUEST_TO_RUN' WHERE PROCESS_NAME='SITE_SIMULATION'"); Master.ShowSuccess("You request for Simulation process is waiting to run!!!"); } //Response.Redirect("~/UTILITIES/Amogh_Utilities.aspx"); //UpateProgressContext(); } catch (Exception exc) { if (exc.Message.Contains("ORA-27478")) { Master.ShowWarn("Site simulation is already running !!!"); } else { Master.ShowWarn(exc.Message); } } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Master.HeadingMessage("Remove Unregistered/Deleted IDF MTO"); string count = WebTools.CountExpr("1", "VIEW_UNREGIS_IDF", " WHERE 1=1"); lblStatus.Text = "Total IDFs : " + count; } }
protected void btnUpload2_Click(object sender, EventArgs e) { if (itemsGrid.SelectedIndexes.Count == 0) { Master.ShowError("Select IRN to continue"); return; } //string filepath = "G:\\AMC work\\temp\\ir\\"; string filepath = WebTools.GetExpr("PATH", "DIR_OBJECTS", " WHERE DIR_ID=6"); //Server.MapPath("\\Upload"); HttpFileCollection uploadedFiles = Request.Files; try { string irn_id = itemsGrid.SelectedValue.ToString(); string irn_no = WebTools.GetExpr("IRN_NO", "PIP_PO_IRN", " WHERE IRN_ID='" + irn_id + "'"); irn_no = irn_no.Replace("/", "-"); string queryupload = "SELECT COUNT(IRN_ID) FROM PIP_PO_IR_DOCS WHERE IRN_ID='" + irn_id + "'"; string maxdoc = WebTools.CountExpr("IRN_ID", "PIP_PO_IR_DOCS", " WHERE IRN_ID=" + irn_id); int doccnt = 0; if (maxdoc == "") { doccnt = 1; } else { doccnt = int.Parse(maxdoc); } for (int i = 0; i < uploadedFiles.Count; i++) { ++doccnt; HttpPostedFile userPostedFile = uploadedFiles[i]; if (userPostedFile.ContentLength > 0) { string Extension = Path.GetExtension(userPostedFile.FileName); string u_file_name = Path.GetFileName(userPostedFile.FileName); u_file_name = u_file_name.Replace("'", ""); string Filename = irn_no + "_" + doccnt + Extension; userPostedFile.SaveAs(filepath + "\\" + Filename); string query = "INSERT INTO PIP_PO_IR_DOCS(IRN_ID,DOC_NAME,DOC_EXT,DIR_ID,U_FILE_NAME) VALUES(" + irn_id + ",'" + Filename + "','" + Extension + "','" + 6 + "','" + u_file_name + "')"; WebTools.ExeSql(query); } } Master.ShowSuccess("IR Files Saved"); } catch (Exception Ex) { Master.ShowError(Ex.Message); } }
protected void btnSave_Click(object sender, EventArgs e) { VIEW_ADAPTER_MAT_RCV_DETAILTableAdapter mrr = new VIEW_ADAPTER_MAT_RCV_DETAILTableAdapter(); decimal mat_id; string mat_code1; string bal_to_recv, mr_item; string rel_qty; string irn_id = ""; try { foreach (GridDataItem item in itemsGrid.SelectedItems) { mat_code1 = item["MAT_CODE1"].Text; //mat_id = WebTools.GetMatId(mat_code1, decimal.Parse(Session["PROJECT_ID"].ToString())); mat_id = decimal.Parse(WebTools.GetExpr("MAT_ID", "PIP_MAT_STOCK", " WHERE MAT_CODE1='" + mat_code1 + "'")); //irn_id = WebTools.GetExpr("IRN_ID", "PIP_MAT_RECEIVE_IRN", " WHERE MAT_RCV_ID = '" + Request.QueryString["MAT_RCV_ID"].ToString()+ "'"); irn_id = WebTools.GetExpr("IRN_ID", "PIP_PO_IRN", " WHERE IRN_NO = '" + item["IRN_NO"].Text + "'"); bal_to_recv = WebTools.GetExpr("BAL_TO_RECV", "VIEW_IRN_BAL_TO_RECV", " WHERE IRN_ID = '" + irn_id + "' AND PO_ITEM='" + item["PO_ITEM"].Text + "' AND MAT_ID='" + mat_id + "'"); //bal_to_recv = (item["BAL_TO_RECV"].FindControl("BAL_TO_RECVLabel") as TextBox).Text; mr_item = WebTools.CountExpr("(1)", "PIP_MAT_RECEIVE_DETAIL", " WHERE MAT_RCV_ID='" + Request.QueryString["MAT_RCV_ID"].ToString() + "'"); string RECV_QTY = (item["BAL_TO_RECV"].FindControl("BAL_TO_RECVLabel") as TextBox).Text; if ((decimal.Parse(item["RELEASE_QTY"].Text) - decimal.Parse(item["RECV_QTY"].Text)) < decimal.Parse(bal_to_recv)) { Master.ShowError("Receive Quantity cannot be more than release qty. "); return; } string pieces = (item["BAL_TO_RECV_PIECES"].FindControl("BAL_TO_RECV_PIECESLabel") as TextBox).Text; if (pieces == "N/A" || pieces == "") { pieces = "0"; } mrr.InsertQuery(decimal.Parse(Request.QueryString["MAT_RCV_ID"]), mat_id, decimal.Parse(RECV_QTY), null, null, item["PO_ITEM"].Text, null, (Decimal.Parse(mr_item) + 1).ToString(), null, (decimal.Parse(item["IRN_ID"].Text)), decimal.Parse(pieces)); } Master.ShowMessage("Selected Items Added to MRR."); } catch (Exception ex) { Master.ShowError(ex.Message); } finally { itemsGrid.Rebind(); } }
protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { try { if (e.CommandName == "Delete") { int index = e.Item.RowIndex; var item = RadGrid1.Items[index - 2] as Telerik.Web.UI.GridDataItem; var joint_id = item.GetDataKeyValue("JOINT_ID"); var repair_code = item.GetDataKeyValue("REPAIR_CODE"); string count = WebTools.CountExpr("JOINT_ID", "PIP_NDE_REQUEST_JOINTS", " REPAIR_CODE IS NOT NULL AND JOINT_ID=" + joint_id + " AND REPAIR_CODE='" + repair_code + "'"); if (count.ToString() != "0") { e.Canceled = true; ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('This Joint exists in other modules.It cannot be deleted!')", true); return; } else { e.Canceled = false; } } if (e.CommandName == "Edit") { int index = e.Item.RowIndex; var item = RadGrid1.Items[index - 2] as Telerik.Web.UI.GridDataItem; var joint_id = item.GetDataKeyValue("JOINT_ID"); // HiddenField1.Value = WebTools.GetExpr("WPS_NO", "PIP_SPOOL_JOINTS", " WHERE JOINT_ID=" + joint_id); HiddenField2.Value = WebTools.GetExpr("JOINT_SIZE_DEC", "PIP_SPOOL_JOINTS", " WHERE JOINT_ID=" + joint_id); HiddenField3.Value = WebTools.GetExpr("JOINT_THK", "PIP_SPOOL_JOINTS", " WHERE JOINT_ID=" + joint_id); string cat_id = WebTools.GetExpr("CAT_ID", "PIP_SPOOL_JOINTS", " WHERE JOINT_ID=" + joint_id); if (cat_id == "1" || cat_id == "3") { HiddenField1.Value = "1"; } else { HiddenField1.Value = "2"; } } } catch (Exception exc) { Master.ShowError(exc.Message); } }
protected void btnSimulation_Click(object sender, EventArgs e) { try { //CHECK status of //1. PO link //2. Line MTO simulation //3. Updae server status //if not running then proceed string po_status = "", any_update_running = "", temp_sml_status = ""; temp_sml_status = WebTools.GetExpr("CURRENT_STATUS", "PROJECT_JOB_LIST", "PROCESS_NAME='TEMP_SIMULATION'"); if (temp_sml_status.Equals("RUNNING")) { lblMessage.Text = "Temp Simulation is already running!!!"; return; } po_status = WebTools.GetExpr("CURRENT_STATUS", "PROJECT_JOB_LIST", "PROCESS_NAME='IMPORT_PO_DATA'"); any_update_running = WebTools.CountExpr("PROCESS_NAME", "PROJECT_JOB_LIST" , "PROCESS_GROUP='SERVER_UPDATE' AND CURRENT_STATUS='RUNNING'"); //If IDF simulation and PO, both are completed if (!po_status.Equals("RUNNING") && any_update_running.Equals("0")) { string sql = ""; WebTools.ExeSql("UPDATE PROJECT_JOB_LIST SET CURRENT_STATUS='RUNNING' WHERE PROCESS_NAME='TEMP_SIMULATION'"); sql = WebTools.GetExpr("SQL_TO_RUN", "PROJECT_JOB_LIST", " PROCESS_NAME='TEMP_SIMULATION'"); WebTools.ExeSql(sql); lblMessage.Text = "You request is under process, please wait..."; } //If bom simulation is not running else { WebTools.ExeSql("UPDATE PROJECT_JOB_LIST SET CURRENT_STATUS='REQUEST_TO_RUN' WHERE PROCESS_NAME='TEMP_SIMULATION'"); } Master.show_info("Close the window and check the progress Utilities Page !"); } catch (Exception exc) { Master.show_error(exc.Message); } }
protected void btnImport_Click(object sender, EventArgs e) { try { if (!FileUpload1.HasFile) { return; } string proj_id = Session["PROJECT_ID"].ToString(); string FileName = Path.GetFileName(FileUpload1.PostedFile.FileName); string Extension = Path.GetExtension(FileUpload1.PostedFile.FileName); string FolderPath = WebTools.SessionDataPath(); string FilePath = FolderPath + FileName; FileUpload1.SaveAs(FilePath); // delete old data WebTools.ExecNonQuery("DELETE FROM TBL_ISO_ATTRIB_IMP WHERE PROJECT_ID = '" + Session["PROJECT_ID"].ToString() + "'"); FileStream stream = new FileStream(FilePath, FileMode.Open, FileAccess.Read); DataTable dt = new DataTable(); dt = ExcelImport.xlsxToDT2(stream); ExcelImport.ImportDataTable(dt, "TBL_ISO_ATTRIB_IMP", "", "PROJECT_ID", proj_id); WebTools.ExecNonQuery("BEGIN " + "PKG_PAGE_VALIDATION.PROC_UDPATE_ISO_ATTRIBUTE; " + " END;"); string ErrorCount = WebTools.CountExpr("ISO_TITLE1", "TBL_ISO_ATTRIB_IMP", " ISO_ID IS NULL OR ERROR_MSG IS NOT NULL"); Master.show_success("Isometric Attribute Data Imported Successfully with " + ErrorCount + " Errors."); if (Convert.ToInt32(ErrorCount) > 0) { linkDownloadError.Visible = true; } } catch (Exception ex) { Master.show_error(ex.Message); } }
protected void btnSubmit_Click(object sender, EventArgs e) { dsMaterialCTableAdapters.VIEW_ADP_SUBSTITUTE_DTTableAdapter substitu = new dsMaterialCTableAdapters.VIEW_ADP_SUBSTITUTE_DTTableAdapter(); string old_mat_id, old_mat_qty; old_mat_id = WebTools.GetExpr("MAT_ID", "PIP_BOM", "BOM_ID=" + ddBomItem.SelectedValue.ToString()); old_mat_qty = WebTools.GetExpr("NET_QTY", "PIP_BOM", "BOM_ID=" + ddBomItem.SelectedValue.ToString()); decimal new_mat_id = WebTools.GetMatId(txtItemCode.Text, decimal.Parse(Session["PROJECT_ID"].ToString())); if (new_mat_id == 0) { Master.show_error("Material Not Found"); return; } try { substitu.InsertQuery(decimal.Parse(Request.QueryString["REQ_ID"]), decimal.Parse(ddBomItem.SelectedValue.ToString()), decimal.Parse(old_mat_id), decimal.Parse(old_mat_qty), new_mat_id, decimal.Parse(txtNewQty.Text), txtRemarks.Text); string count = WebTools.CountExpr("1", "PIP_MAT_SUBSTITUTE_DETAIL", " WHERE BOM_ID=" + ddBomItem.SelectedValue.ToString()); //if (count == "1") //{ // //NEW ADDITION // string sql1 = "UPDATE PIP_BOM SET OLD_MAT_ID=" + old_mat_id + " WHERE BOM_ID=" + ddBomItem.SelectedValue.ToString(); // WebTools.exec_non_qry(sql1); //} string sql3 = "UPDATE PIP_BOM SET NET_QTY=" + txtNewQty.Text + " WHERE BOM_ID=" + ddBomItem.SelectedValue.ToString(); string sql2 = "UPDATE PIP_BOM SET MAT_ID=" + new_mat_id.ToString() + " WHERE BOM_ID=" + ddBomItem.SelectedValue.ToString(); WebTools.exec_non_qry(sql3); WebTools.exec_non_qry(sql2); Master.show_success("New Item Added."); } catch (Exception ex) { Master.show_error(ex.Message); return; } finally { substitu.Dispose(); } }
protected void btnProceed_Click(object sender, EventArgs e) { string process_name = "UPDATE_ALL"; string upd_status = WebTools.GetExpr("CURRENT_STATUS", "PROJECT_JOB_LIST", " WHERE PROCESS_NAME = '" + process_name + "'"); if (upd_status.Equals("RUNNING")) { Master.ShowWarn("Server update is running, please check status of project jobs!"); return; } upd_status = WebTools.CountExpr("STATUS", "UPDATE_HEADER", " WHERE STATUS = 'PR'"); if (!upd_status.Equals("0")) { Master.ShowWarn("Server update is running, please check status of update headers!"); return; } try { string sql = WebTools.GetExpr("SQL_TO_RUN", "PROJECT_JOB_LIST", " PROCESS_NAME='" + process_name + "'"); WebTools.ExeSql(sql); string user_id = WebTools.GetExpr("USER_ID", "USERS", "UPPER(USER_NAME)='" + Session["USER_NAME"].ToString().ToUpper().Trim() + "'"); sql = "INSERT INTO UPDATE_HEADER(UPD_USER_ID, UPD_DATE, STATUS) VALUES ('" + user_id + "',SYSDATE,'PR')"; WebTools.ExeSql(sql); gridUpdHistory.DataBind(); grdiProgress.DataBind(); Master.ShowMessage("Server update run started..."); } catch (Exception exc) { if (exc.Message.Contains("ORA-27478")) { Master.ShowWarn("Server Update is already running !!!"); } else { Master.ShowWarn(exc.Message); } } }
protected void btnRunSimulation_Click(object sender, EventArgs e) { if (CollectSubCons() && CollectAreas()) { sml_status = WebTools.GetExpr("CURRENT_STATUS", "PROJECT_JOB_LIST", " WHERE PROCESS_NAME = '" + process_name + "'"); if (sml_status.Equals("RUNNING")) { Master.ShowWarn("Simulation is running, please check status of project jobs!"); return; } sml_status = WebTools.CountExpr("STATUS", "SIMULATION_HEADER", " WHERE STATUS = 'PR'"); if (!sml_status.Equals("0")) { Master.ShowWarn("Simulation is running, please check status of simulation headers!"); return; } btnSaveSettings_Click(sender, e); try { string sql = WebTools.GetExpr("SQL_TO_RUN", "PROJECT_JOB_LIST", " PROCESS_NAME='" + process_name + "'"); WebTools.ExeSql(sql); gridSmlHistory.DataBind(); Master.ShowSuccess("Current settings saved and Simulation Run started !!!"); } catch (Exception exc) { if (exc.Message.Contains("ORA-27478")) { Master.ShowWarn("Simulation is already running !!!"); } else { Master.ShowWarn(exc.Message); } } } }
protected string set_current_page_settings() { string counter = WebTools.CountExpr("*", "SIMULATION_SETTING", " WHERE SML_CAT='" + sml_cat + "'"); string query = string.Empty; if (Int32.Parse(counter) > 0) { query = "UPDATE SIMULATION_SETTING SET " + " SML_CAT='" + sml_cat + "'" + ", SML_TIME=TO_CHAR(SYSDATE,'dd-Mon-yyyy HH:MI AM')" + ", SML_USER='******'" + ", DWG_STATUS='" + rdoDwgStatus.SelectedValue + "'" + ", ON_SFR_FIRST='" + rdoSpoolSFR.SelectedValue + "'" + ", ON_SELECTED_SPOOLS='" + rdoSelectedSpools.SelectedValue + "'" + ", ON_SELECTED_ISOME='" + rdoSelectedIsos.SelectedValue + "'" + ", AGUG='" + rdoAGUG.SelectedValue + "'" + ", SML_PRIORITY='" + rdoPriority.SelectedValue + "'" + ", EXCLUDE_HOLD='" + rdoHoldStatus.SelectedValue + "'" + ", MATERIAL_SOURCE='" + rdoMaterialSource.SelectedValue + "'" + ", USE_COMMON_STORE='" + rdoUseCommonStore.SelectedValue + "'" + " WHERE SML_CAT='" + sml_cat + "'"; } else { return("Setting info not updated !"); } try { //return query; WebTools.ExeSql(query); return("Current settings saved !!!"); } catch (Exception exc) { Master.ShowWarn(exc.Message); return(exc.Message); } }
protected void btnSave_Click(object sender, EventArgs e) { try { int code_exist = int.Parse(WebTools.CountExpr("UNIQ_ID", "FLANGE_SYSPID_DATA", " WHERE PID_SEQ='" + Request.QueryString["PID_SEQ"] + "' AND " + "SEQ=" + RadcobSysSub.SelectedValue)); if (code_exist == 0) { FlangeDataSource.Insert(); FlangeGridView.DataBind(); Master.show_success(" Saved succesfully!"); } else { Master.show_error("Already exist Data!"); } } catch (Exception ex) { Master.show_error(ex.Message); } }
protected void btnPOUpdate_Click(object sender, EventArgs e) { try { string po_status = "", any_update_run_count = ""; any_update_run_count = WebTools.CountExpr("PROCESS_NAME", "PROJECT_JOB_LIST", "CURRENT_STATUS='RUNNING' " + " AND (PROCESS_NAME LIKE '%SIMULATION%' OR PROCESS_GROUP='SERVER_UPDATE')"); po_status = WebTools.GetExpr("CURRENT_STATUS", "PROJECT_JOB_LIST", "PROCESS_NAME='IMPORT_PO_DATA'"); if ((po_status.Equals("COMPLETED") || po_status.Equals("REQUEST_TO_RUN")) && any_update_run_count.Equals("0")) { string sql = ""; sql = "UPDATE PROJECT_JOB_LIST SET CURRENT_STATUS='RUNNING' WHERE PROCESS_NAME='IMPORT_PO_DATA'"; WebTools.ExeSql(sql); sql = WebTools.GetExpr("SQL_TO_RUN", "PROJECT_JOB_LIST", " PROCESS_NAME='IMPORT_PO_DATA'"); WebTools.ExeSql(sql); Master.ShowMessage("You request is under process, please wait..."); SetPPCSRunning(); } else if (!po_status.Equals("RUNNING")) { WebTools.ExeSql("UPDATE PROJECT_JOB_LIST SET CURRENT_STATUS='REQUEST_TO_RUN' WHERE PROCESS_NAME='IMPORT_PO_DATA'"); Master.ShowMessage("You request is under process, please wait..."); } else { Master.ShowWarn("<font color='red'>Sorry, your request can not be processed now !!!</font>"); } } catch (Exception exc) { Master.ShowWarn(exc.Message); } }
protected void btnServerUpdate_Click(object sender, EventArgs e) { menuUpdateAll.Skin = "Sunset"; try { string query = "UPDATE SIMULATION_SETTING SET UPDATE_USER='******', UPDATE_TIME=TO_CHAR(SYSDATE,'dd-Mon-yyyy (HH:MI AM)')"; WebTools.exec_non_qry(query); string any_update_run_count = WebTools.CountExpr("PROCESS_NAME", "PROJECT_JOB_LIST", "CURRENT_STATUS='RUNNING'" + " AND (PROCESS_GROUP='SERVER_UPDATE' OR PROCESS_NAME='BOM_SIMULATION' OR PROCESS_NAME='FULL_SIMULATION' OR PROCESS_NAME='IMPORT_PO_DATA')"); string update_all_status = WebTools.GetExpr("CURRENT_STATUS", "PROJECT_JOB_LIST", "PROCESS_NAME='UPDATE_ALL'"); if (any_update_run_count.Equals("0")) { string sql = ""; sql = "UPDATE PROJECT_JOB_LIST SET CURRENT_STATUS='RUNNING' WHERE PROCESS_GROUP='SERVER_UPDATE'"; WebTools.ExeSql(sql); sql = WebTools.GetExpr("SQL_TO_RUN", "PROJECT_JOB_LIST", " PROCESS_NAME='UPDATE_ALL'"); WebTools.ExeSql(sql); Master.ShowMessage("You request is under process, please wait..."); } else if (!update_all_status.Equals("RUNNING")) { WebTools.ExeSql("UPDATE PROJECT_JOB_LIST SET CURRENT_STATUS='REQUEST_TO_RUN' WHERE PROCESS_NAME='UPDATE_ALL'"); lblMessage.Text = "You request is under process, please wait..."; } else { lblMessage.Text = "<font color='red'>Sorry, your request can not be processed now !!!</font>"; } } catch (Exception exc) { lblMessage.Text = exc.Message; } }
protected void btnRunSimulation_Click(object sender, EventArgs e) { sml_status = WebTools.GetExpr("CURRENT_STATUS", "PROJECT_JOB_LIST", " WHERE PROCESS_NAME = 'BOM_SIMULATION'"); if (CollectSubCons()) { if (sml_status.Equals("RUNNING")) { Master.ShowSuccess("Ooops... Simulation is already running !!!"); //return; } btnSaveSettings_Click(sender, e); try { string user_id = WebTools.GetExpr("USER_ID", "USERS", "UPPER(USER_NAME)=UPPER('" + Session["USER_NAME"].ToString() + "')"); string sql_new_sml_header = ""; sql_new_sml_header = "INSERT INTO SIMULATION_HEADER(sml_user_id,sml_cat_id,sml_date,exclude_hold,dwg_status,on_sfr_first" + ",agug,sml_priority,on_selected_spools,use_common_store,material_source)" + "VALUES('" + user_id + "','1',SYSDATE,'" + rdoHoldStatus.SelectedValue + "','" + rdoDwgStatus.SelectedValue + "','" + rdoSpoolSFR.SelectedValue + "','" + rdoAGUG.SelectedValue + "','" + rdoPriority.SelectedValue + "','" + rdoSelectedSpools.SelectedValue + "','" + rdoUseCommonStore.SelectedValue + "','" + rdoMaterialSource.SelectedValue + "')"; WebTools.exec_non_qry(sql_new_sml_header); //Master.ShowSuccess(sql_new_sml_header); return; //CHECK status of //1. PO link //2. Line MTO simulation //3. Updae server status //if not running then proceed string po_status = "", any_update_running = ""; po_status = WebTools.GetExpr("CURRENT_STATUS", "PROJECT_JOB_LIST", "PROCESS_NAME='IMPORT_PO_DATA'"); any_update_running = WebTools.CountExpr("PROCESS_NAME", "PROJECT_JOB_LIST", "PROCESS_GROUP='SERVER_UPDATE' AND CURRENT_STATUS='RUNNING'"); //If IDF simulation and PO, both are completed if (!po_status.Equals("RUNNING") && any_update_running.Equals("0")) { string sql = ""; WebTools.ExeSql("UPDATE PROJECT_JOB_LIST SET CURRENT_STATUS='RUNNING' WHERE PROCESS_NAME='BOM_SIMULATION'"); sql = WebTools.GetExpr("SQL_TO_RUN", "PROJECT_JOB_LIST", " PROCESS_NAME='BOM_SIMULATION'"); WebTools.ExeSql(sql); Master.ShowSuccess("You request for Simulation has started !!!"); } //If bom simulation is not running else { WebTools.ExeSql("UPDATE PROJECT_JOB_LIST SET CURRENT_STATUS='REQUEST_TO_RUN' WHERE PROCESS_NAME='BOM_SIMULATION'"); Master.ShowSuccess("You request for Simulation process is waiting to run!!!"); } // Response.Redirect("~/UTILITIES/Amogh_Utilities.aspx"); //UpateProgressContext(); } catch (Exception exc) { if (exc.Message.Contains("ORA-27478")) { Master.ShowWarn("Simulation is already running !!!"); } else { Master.ShowWarn(exc.Message); } } } }
protected void btnValidate_Click(object sender, EventArgs e) { if (!FileUpload1.HasFile) { return; } string proj_id = Session["PROJECT_ID"].ToString(); string FileName = Path.GetFileName(FileUpload1.PostedFile.FileName); string Extension = Path.GetExtension(FileUpload1.PostedFile.FileName); string FolderPath = WebTools.SessionDataPath(); string FilePath = FolderPath + FileName; FileUpload1.SaveAs(FilePath); string tbl_name = WebTools.GetExpr("IMP_REP_TABLE", "PIP_BULK_IMPORT_REP", " IMP_REP_ID=" + Request.QueryString["IMPORT_ID"]); string user_id = WebTools.GetExpr("USER_ID", "USERS", " Upper(USER_NAME)='" + Session["USER_NAME"].ToString().ToUpper() + "'"); string proj_field = WebTools.GetExpr("IMP_PROJ_ID_FIELD", "PIP_BULK_IMPORT_REP", " IMP_REP_ID=" + Request.QueryString["IMPORT_ID"]); // delete old data WebTools.ExecNonQuery("DELETE FROM " + tbl_name + " Where USER_ID = '" + user_id + "'"); FileStream stream; DataTable dt; stream = new FileStream(FilePath, FileMode.Open, FileAccess.Read); dt = new DataTable(); dt = ExcelImport.xlsxToDT2(stream); dt.Columns.Add("USER_ID"); foreach (DataRow r in dt.Rows) { r["USER_ID"] = user_id; } ExcelImport.ImportDataTable(dt, tbl_name, "", proj_field, proj_id); try { //WebTools.ExecNonQuery() string valid_pkg = WebTools.GetExpr("IMP_VALIDATE_PKG", "PIP_BULK_IMPORT_REP", " IMP_REP_ID=" + Request.QueryString["IMPORT_ID"]); string upd_pkg = WebTools.GetExpr("IMP_UPDATE_PKG", "PIP_BULK_IMPORT_REP", " IMP_REP_ID=" + Request.QueryString["IMPORT_ID"]); if (valid_pkg.Trim().Length > 0) { WebTools.ExecNonQuery("BEGIN " + valid_pkg + "(" + user_id + "); " + " END;"); } if (upd_pkg.Trim().Length > 0) { WebTools.ExecNonQuery("BEGIN " + upd_pkg + "(" + user_id + "); " + " END;"); } //string user_id = WebTools.GetExpr("USER_ID", "USERS", " USER_NAME='" + Session["USER_NAME"].ToString() + "'"); string sql = WebTools.GetExpr("GRID_SQL_TEXT", "PIP_BULK_IMPORT_REP", " IMP_REP_ID=" + Request.QueryString["IMPORT_ID"]); itemsDataSource.SelectCommand = sql.Replace("PARAM", user_id); sql = WebTools.GetExpr("IMP_ERR_LOG_SQL", "PIP_BULK_IMPORT_REP", " IMP_REP_ID=" + Request.QueryString["IMPORT_ID"]); itemsErrorSource.SelectCommand = sql.Replace("PARAM", user_id); linkImportFormat.NavigateUrl = WebTools.GetExpr("SAMPLE_FILE_URL", "PIP_BULK_IMPORT_REP", " IMP_REP_ID=" + Request.QueryString["IMPORT_ID"]); itemsGrid.Rebind(); string err_table = WebTools.GetExpr("IMP_REP_TABLE", "PIP_BULK_IMPORT_REP", " IMP_REP_ID=" + Request.QueryString["IMPORT_ID"]); int totalRows = dt.Rows.Count - 1; int ErrorRows = int.Parse(WebTools.CountExpr("STATUS", err_table, " USER_ID = " + user_id + "AND STATUS IS NOT NULL")); if (ErrorRows > 0) { Master.ShowError("Total Records : " + totalRows + " <br/> Successful : " + (totalRows - ErrorRows) + " <br/> Errors : " + ErrorRows); } else { Master.ShowMessage("Total Records : " + totalRows + " <br/> Successful : " + (totalRows - ErrorRows)); } } catch (Exception ex) { Master.ShowError(ex.Message); } finally { stream.Close(); dt.Dispose(); } }
protected void btnSave_Click(object sender, EventArgs e) { string pwht_type = string.Empty; string repair_cnt_nde_req = string.Empty; string repair_cnt_entry = string.Empty; string repair_cnt_nde_req_ut = string.Empty; string repair_cnt_entry_ut = string.Empty; pwht_type = WebTools.GetExpr("NVL(PWHT,'N')", "PIP_SPOOL_JOINTS", " JOINT_ID=" + Decimal.Parse(cboJoints.SelectedValue)); repair_cnt_nde_req = WebTools.CountExpr("JOINT_ID", "PIP_NDE_REQUEST_JOINTS", " PASS_FLG_ID=2 AND NDE_TYPE_ID IN (1,9,12,15) AND JOINT_ID=" + Decimal.Parse(cboJoints.SelectedValue) + " GROUP BY JOINT_ID"); repair_cnt_entry = WebTools.CountExpr("JOINT_ID", "PIP_JOINTS_REPAIR_DWR", " JOINT_ID=" + Decimal.Parse(cboJoints.SelectedValue) + " GROUP BY JOINT_ID"); if ((decimal.Parse(repair_cnt_nde_req.ToString()) > 0 && decimal.Parse(repair_cnt_entry.ToString()) > 0)) { if ((decimal.Parse(repair_cnt_nde_req.ToString()) == decimal.Parse(repair_cnt_entry.ToString()))) { Master.ShowError("Repair Information already exists, cannot be updated!"); return; } } if (drpWelder1.SelectedValue == "-1" && drpWelder2.SelectedValue == "-1" && drpWelder3.SelectedValue == "-1" && drpWelder4.SelectedValue == "-1") { Master.ShowError("No Repair Welder Selected."); return; } if (drpRepairCode.SelectedIndex == -1) { Master.ShowError("Select Repair Code"); return; } if (cboWps.SelectedIndex == -1) { Master.ShowError("Select WPS No."); return; } // VIEW_ADAPTER_NDE_STATUSTableAdapter adpt = new VIEW_ADAPTER_NDE_STATUSTableAdapter(); try { string wps_no = string.Empty; DateTime REP_DATE; REP_DATE = DateTime.Parse(txtRepDate.SelectedDate.ToString()); string REP_DATE_STRING; REP_DATE_STRING = REP_DATE.ToString("dd-MMM-yyyy"); //DAILY_WLD_WPS in PROJECT_INFORMATION //A-->Dropdown //B-->Textbox // string wps_entry = WebTools.GetExpr("DAILY_WLD_WPS", "PROJECT_INFORMATION"," WHERE PROJECT_ID=" + Session["PROJECT_ID"].ToString()); wps_no = cboWps.SelectedItem.Text.ToString(); string sql; sql = "INSERT INTO PIP_JOINTS_REPAIR_DWR (JOINT_ID,REPAIR_CODE, REPAIR_DATE, WELD_REPORT_NO, WPS_NO) VALUES ("; sql += Decimal.Parse(cboJoints.SelectedValue) + ","; sql += "'" + drpRepairCode.SelectedValue + "'" + ","; sql += "'" + REP_DATE_STRING + "'" + ","; sql += "'" + txtWeldRepNo.Text + "'" + ","; if (wps_no != "null") { sql += "'" + wps_no + "'" + ")"; } else { sql += "''" + ")"; } string weldersql = ""; if (drpWelder1.SelectedValue != "null") { weldersql = "INSERT INTO PIP_SPOOL_WELDING(JOINT_ID,WELDER_ID,REPAIR_CODE,PASS_ID) VALUES(" + Decimal.Parse(cboJoints.SelectedValue) + "," + drpWelder1.SelectedValue + ",'" + drpRepairCode.SelectedValue.ToString() + "',1)"; WebTools.ExeSql(weldersql); } if (drpWelder2.SelectedValue != "null") { weldersql = "INSERT INTO PIP_SPOOL_WELDING(JOINT_ID,WELDER_ID,REPAIR_CODE,PASS_ID) VALUES(" + Decimal.Parse(cboJoints.SelectedValue) + "," + drpWelder2.SelectedValue + ",'" + drpRepairCode.SelectedValue.ToString() + "',2)"; WebTools.ExeSql(weldersql); } if (drpWelder3.SelectedValue != "null") { weldersql = "INSERT INTO PIP_SPOOL_WELDING(JOINT_ID,WELDER_ID,REPAIR_CODE,PASS_ID) VALUES(" + Decimal.Parse(cboJoints.SelectedValue) + "," + drpWelder3.SelectedValue + ",'" + drpRepairCode.SelectedValue.ToString() + "',3)"; WebTools.ExeSql(weldersql); } if (drpWelder4.SelectedValue != "null") { weldersql = "INSERT INTO PIP_SPOOL_WELDING(JOINT_ID,WELDER_ID,REPAIR_CODE,PASS_ID) VALUES(" + Decimal.Parse(cboJoints.SelectedValue) + "," + drpWelder4.SelectedValue + ",'" + drpRepairCode.SelectedValue.ToString() + "',4)"; WebTools.ExeSql(weldersql); } string rep_date_sql = "UPDATE PIP_SPOOL_JOINTS SET REPAIR_DATE=" + "'" + REP_DATE_STRING + "'" + " WHERE JOINT_ID=" + Decimal.Parse(cboJoints.SelectedValue); try { WebTools.ExeSql(sql); WebTools.ExeSql(rep_date_sql); RadGrid1.DataBind(); Master.ShowSuccess("Saved Successfully!!"); cboJoints.SelectedIndex = -1; } catch (Exception ex) { Master.ShowMessage(ex.Message); return; } // adpt.Dispose(); ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Repair Information Updated successfully!')", true); } catch (Exception ex) { //ScriptManager.RegisterStartupScript(this, GetType(), "show alert", "alert('Error!!!')", true); Master.ShowMessage(ex.Message); return; } finally { // adpt.Dispose(); } }
protected void btnImport_Click(object sender, EventArgs e) { try { if (RadAsyncUpload1.UploadedFiles.Count == 0 && RadAsyncUpload2.UploadedFiles.Count == 0) { Master.show_error("Please Upload File to proceed."); return; } if (Request.QueryString["REF_ID"] == "") { Master.show_error("Select Transmittal"); return; } /////////////////////////////////////////////////////////////////////////////////////////////////////// if (RadAsyncUpload1.UploadedFiles.Count > 0) { int type_id = int.Parse(Request.QueryString["TYPE_ID"]); int ref_id = int.Parse(Request.QueryString["REF_ID"].ToString()); string proj_id = Session["PROJECT_ID"].ToString(); string user_id = WebTools.GetExpr("USER_ID", "USERS", " USER_NAME ='" + Session["USER_NAME"] + "'"); string f_name = ""; string dir_obj = ""; string dir_id = ""; string delquery = ""; // string irn_id = itemsGrid.SelectedValue.ToString(); switch (type_id) { case 8: f_name = WebTools.GetExpr("MR_NO", "PIP_MAT_REQUISITION", " WHERE MR_ID='" + ref_id + "'"); dir_obj = "REQUISITION"; delquery = "DELETE FROM PIP_FILE_UPLOAD WHERE type_id=" + type_id + " AND REF_ID=" + ref_id; WebTools.ExeSql(delquery); dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; case 9: f_name = WebTools.GetExpr("PO_NO", "PIP_PO", " WHERE PO_ID='" + ref_id + "'"); dir_obj = "PO_MASTER"; delquery = "DELETE FROM PIP_FILE_UPLOAD WHERE type_id=" + type_id + " AND REF_ID=" + ref_id; WebTools.ExeSql(delquery); dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; case 10: f_name = WebTools.GetExpr("RFI_NO", "PIP_PO_INSP_REQUEST", " WHERE RFI_ID='" + ref_id + "'"); dir_obj = "PO_RFI"; delquery = "DELETE FROM PIP_FILE_UPLOAD WHERE type_id=" + type_id + " AND REF_ID=" + ref_id; WebTools.ExeSql(delquery); dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; case 11: f_name = WebTools.GetExpr("MAT_RCV_NO", "PIP_MAT_RECEIVE", " WHERE MAT_RCV_ID='" + ref_id + "'"); dir_obj = "MRR"; delquery = "DELETE FROM PIP_FILE_UPLOAD WHERE type_id=" + type_id + " AND REF_ID=" + ref_id; WebTools.ExeSql(delquery); dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; case 12: f_name = WebTools.GetExpr("RFI_NO", "PIP_MAT_INSP_REQUEST", " WHERE RFI_ID='" + ref_id + "'"); dir_obj = "MAT_RFI"; delquery = "DELETE FROM PIP_FILE_UPLOAD WHERE type_id=" + type_id + " AND REF_ID=" + ref_id; WebTools.ExeSql(delquery); dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; case 13: f_name = WebTools.GetExpr("MIR_NO", "PRC_MAT_INSP", " WHERE MIR_ID='" + ref_id + "'"); dir_obj = "MRIR"; delquery = "DELETE FROM PIP_FILE_UPLOAD WHERE type_id=" + type_id + " AND REF_ID=" + ref_id; WebTools.ExeSql(delquery); dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; case 14: f_name = WebTools.GetExpr("MAT_REQ_NO", "MATERIAL_REQUEST", " WHERE MAT_REQ_ID='" + ref_id + "'"); dir_obj = "MAT_REQUEST"; delquery = "DELETE FROM PIP_FILE_UPLOAD WHERE type_id=" + type_id + " AND REF_ID=" + ref_id; WebTools.ExeSql(delquery); dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; case 15: f_name = WebTools.GetExpr("ISSUE_NO", "PIP_MAT_ISSUE_ADD", " WHERE ADD_ISSUE_ID='" + ref_id + "'"); dir_obj = "MAT_ISSUE"; delquery = "DELETE FROM PIP_FILE_UPLOAD WHERE type_id=" + type_id + " AND REF_ID=" + ref_id; WebTools.ExeSql(delquery); dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; case 16: f_name = WebTools.GetExpr("TRANSF_NO", "PIP_MAT_TRANSF", " WHERE TRANSF_ID='" + ref_id + "'"); dir_obj = "MAT_TRANSFER"; delquery = "DELETE FROM PIP_FILE_UPLOAD WHERE type_id=" + type_id + " AND REF_ID=" + ref_id; WebTools.ExeSql(delquery); dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; case 17: f_name = WebTools.GetExpr("RCV_NUMBER", "PIP_MAT_TRANSFER_RCV", " WHERE RCV_ID='" + ref_id + "'"); dir_obj = "TRANSF_RCV"; delquery = "DELETE FROM PIP_FILE_UPLOAD WHERE type_id=" + type_id + " AND REF_ID=" + ref_id; WebTools.ExeSql(delquery); dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; case 28: f_name = WebTools.GetExpr("RETURN_NO", "PIP_MAT_RETURN", " WHERE MAT_RET_ID='" + ref_id + "'"); dir_obj = "MAT_RETURN"; delquery = "DELETE FROM PIP_FILE_UPLOAD WHERE type_id=" + type_id + " AND REF_ID=" + ref_id; WebTools.ExeSql(delquery); dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; case 30: f_name = WebTools.GetExpr("VO_NO", "PIP_PO_VARIATION", " WHERE VO_ID='" + ref_id + "'"); dir_obj = "PO_VO"; delquery = "DELETE FROM PIP_FILE_UPLOAD WHERE type_id=" + type_id + " AND REF_ID=" + ref_id; WebTools.ExeSql(delquery); dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; case 31: f_name = WebTools.GetExpr("REP_NO", "PIP_MAT_EXCEPTION_REP", " WHERE EXCP_ID='" + ref_id + "'"); dir_obj = "ESD"; delquery = "DELETE FROM PIP_FILE_UPLOAD WHERE type_id=" + type_id + " AND REF_ID=" + ref_id; WebTools.ExeSql(delquery); dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; case 32: f_name = WebTools.GetExpr("QRNTINE_NO", "PIP_QUARANTINE", " WHERE QRNTINE_ID='" + ref_id + "'"); dir_obj = "MAT_QUARANTINE"; delquery = "DELETE FROM PIP_FILE_UPLOAD WHERE type_id=" + type_id + " AND REF_ID=" + ref_id; WebTools.ExeSql(delquery); dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; } f_name = f_name.Replace("/", "-"); string Extension = Path.GetExtension(RadAsyncUpload1.UploadedFiles[0].GetExtension()); string FileName = f_name + Extension; string u_file_name = Path.GetFileName(RadAsyncUpload1.UploadedFiles[0].GetNameWithoutExtension()); string FolderPath = WebTools.GetExpr("PATH", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); string FilePath = FolderPath + FileName; System.IO.File.Delete(FilePath); RadAsyncUpload1.UploadedFiles[0].SaveAs(FilePath); string query = "INSERT INTO PIP_FILE_UPLOAD(TYPE_ID,REF_ID,DOC_NAME,DOC_EXT,DIR_ID,U_FILE_NAME,CREATED_BY) VALUES(" + type_id + "," + ref_id + ",'" + FileName + "','" + Extension + "','" + dir_id + "','" + u_file_name + "'," + decimal.Parse(user_id) + ")"; WebTools.ExeSql(query); Master.show_success("File Uploaded"); } if (RadAsyncUpload2.UploadedFiles.Count > 0) { int type_id = int.Parse(Request.QueryString["TYPE_ID"]); int ref_id = int.Parse(Request.QueryString["REF_ID"].ToString()); string proj_id = Session["PROJECT_ID"].ToString(); string user_id = WebTools.GetExpr("USER_ID", "USERS", " USER_NAME ='" + Session["USER_NAME"] + "'"); int filecount = RadAsyncUpload2.UploadedFiles.Count; string maxdoc = WebTools.CountExpr("REF_ID", "PIP_SUPP_FILE_UPLOAD", " WHERE TYPE_ID = " + type_id + " AND REF_ID = " + ref_id); int doccnt = 0; if (maxdoc == "") { doccnt = 1; } else { doccnt = int.Parse(maxdoc) + 1; } for (int i = 0; i < filecount; i++) { string f_name = ""; string dir_obj = ""; string dir_id = ""; // string irn_id = itemsGrid.SelectedValue.ToString(); switch (type_id) { case 8: f_name = WebTools.GetExpr("MR_NO", "PIP_MAT_REQUISITION", " WHERE MR_ID='" + ref_id + "'"); dir_obj = "MR_SUPP"; dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; case 9: f_name = WebTools.GetExpr("PO_NO", "PIP_PO", " WHERE PO_ID='" + ref_id + "'"); dir_obj = "PO_MASTER_SUPP"; dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; case 10: f_name = WebTools.GetExpr("RFI_NO", "PIP_PO_INSP_REQUEST", " WHERE RFI_ID='" + ref_id + "'"); dir_obj = "PO_RFI_SUPP"; dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; case 11: f_name = WebTools.GetExpr("MAT_RCV_NO", "PIP_MAT_RECEIVE", " WHERE MAT_RCV_ID='" + ref_id + "'"); dir_obj = "MRR_SUPP"; dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; case 12: f_name = WebTools.GetExpr("RFI_NO", "PIP_MAT_INSP_REQUEST", " WHERE RFI_ID='" + ref_id + "'"); dir_obj = "MAT_RFI_SUPP"; dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; case 13: f_name = WebTools.GetExpr("MIR_NO", "PRC_MAT_INSP", " WHERE MIR_ID='" + ref_id + "'"); dir_obj = "MRIR_SUPP"; dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; case 14: f_name = WebTools.GetExpr("MAT_REQ_NO", "MATERIAL_REQUEST", " WHERE MAT_REQ_ID='" + ref_id + "'"); dir_obj = "MAT_REQ_SUPP"; dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; case 15: f_name = WebTools.GetExpr("ISSUE_NO", "PIP_MAT_ISSUE_ADD", " WHERE ADD_ISSUE_ID='" + ref_id + "'"); dir_obj = "MAT_ISSUE_SUPP"; dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; case 16: f_name = WebTools.GetExpr("TRANSF_NO", "PIP_MAT_TRANSF", " WHERE TRANSF_ID='" + ref_id + "'"); dir_obj = "MAT_TRANSF_SUPP"; dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; case 17: f_name = WebTools.GetExpr("RCV_NUMBER", "PIP_MAT_TRANSFER_RCV", " WHERE RCV_ID='" + ref_id + "'"); dir_obj = "TRANSF_RCV_SUPP"; dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; case 28: f_name = WebTools.GetExpr("RETURN_NO", "PIP_MAT_RETURN", " WHERE MAT_RET_ID='" + ref_id + "'"); dir_obj = "MAT_RETURN_SUPP"; dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; case 30: f_name = WebTools.GetExpr("VO_NO", "PIP_PO_VARIATION", " WHERE VO_ID='" + ref_id + "'"); dir_obj = "PO_VO_SUPP"; dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; case 31: f_name = WebTools.GetExpr("REP_NO", "PIP_MAT_EXCEPTION_REP", " WHERE EXCP_ID='" + ref_id + "'"); dir_obj = "ESD_SUPP"; dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; case 32: f_name = WebTools.GetExpr("QRNTINE_NO", "PIP_QUARANTINE", " WHERE QRNTINE_ID='" + ref_id + "'"); dir_obj = "MAT_QRTINE_SUPP"; dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; } f_name = f_name.Replace("/", "-"); string Extension = Path.GetExtension(RadAsyncUpload2.UploadedFiles[i].GetExtension()); string FileName = f_name + "_" + doccnt++ + Extension; string u_file_name = Path.GetFileName(RadAsyncUpload2.UploadedFiles[i].GetNameWithoutExtension()); u_file_name = u_file_name.Replace("'", ""); string FolderPath = WebTools.GetExpr("PATH", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); string FilePath = FolderPath + FileName; RadAsyncUpload2.UploadedFiles[i].SaveAs(FilePath); string query = "INSERT INTO PIP_SUPP_FILE_UPLOAD(TYPE_ID,REF_ID,DOC_NAME,DOC_EXT,DIR_ID,U_FILE_NAME,CREATED_BY) VALUES(" + type_id + "," + ref_id + ",'" + FileName + "','" + Extension + "','" + dir_id + "','" + u_file_name + "'," + decimal.Parse(user_id) + ")"; WebTools.ExeSql(query); Master.show_success("Files Uploaded"); } } } catch (Exception ex) { Master.show_error(ex.Message); } }
protected void btnSave_Click(object sender, EventArgs e) { try { if (chk4.Checked == true) { if (txtchk4.Text == "") { Master.ShowError("Fill check box 4 text value"); return; } } if (chk7.Checked == true) { if (txtchk7.Text == "") { Master.ShowError("Fill check box 7 text value"); return; } } string uname = Session["USER_NAME"].ToString().ToUpper(); string user_id = WebTools.GetExpr("USER_ID", "USERS", " WHERE UPPER(USER_NAME)='" + uname + "'"); VIEW_PO_IRNTableAdapter irn = new VIEW_PO_IRNTableAdapter(); string dclient = "N"; if (chkDClient.Checked == true) { dclient = "Y"; } string dsupp = "N"; if (chkDSupp.Checked == true) { dsupp = "Y"; } string dsubsupp = "N"; if (chkDSubSup.Checked == true) { dsubsupp = "Y"; } string dsubcon = "N"; if (chkDSubcon.Checked == true) { dsubcon = "Y"; } irn.InsertQuery(decimal.Parse(Session["PROJECT_ID"].ToString()), txtIRNNumber.Text, txtRev.Text, txtIRNCreateDate.SelectedDate, vendorType.SelectedValue, poStatus.SelectedValue, decimal.Parse(ddlVendor.SelectedValue), vendorReport.SelectedValue, txtRemarks.Text, decimal.Parse(user_id), ddlInspResult.SelectedValue, decimal.Parse(ddlPO.SelectedValue), txtPOContact.Text, txtPOEmail.Text, txtPOPhone.Text, txtVendorContactName.Text, txtVendorPhone.Text, dclient, dsupp, dsupp, dsubcon, txtPreparedBy.Text, txtReviewedBy.Text, txtApprovedBy.Text, ddlVO.SelectedValue); //register RFI var collection = ddlRFINo.CheckedItems; string irn_id = WebTools.GetExpr("IRN_ID", "PIP_PO_IRN", " WHERE IRN_NO='" + txtIRNNumber.Text + "'"); foreach (var item in collection) { string q = "INSERT INTO PIP_PO_IRN_RFI VALUES(" + decimal.Parse(irn_id) + ",'" + item.Value + "')"; WebTools.ExeSql(q); } //marjor irn reports var major = MajorIReports.CheckedItems; foreach (var item in major) { string q = "INSERT INTO PIP_PO_IRN_MAJOR_REPORT VALUES(" + decimal.Parse(irn_id) + ",'" + item.Value + "')"; WebTools.ExeSql(q); } //irn result checkboxes need to move to for loop if (chk1.Checked == true) { string q = "INSERT INTO PIP_PO_IRN_RESULT(IRN_ID, RESULT_TEXT, REMARKS, IRN_RESULT_ID) VALUES(" + decimal.Parse(irn_id) + ",+'" + lb1.Text + "',null,1)"; WebTools.ExeSql(q); } if (chk2.Checked == true) { string q = "INSERT INTO PIP_PO_IRN_RESULT(IRN_ID, RESULT_TEXT, REMARKS, IRN_RESULT_ID) VALUES(" + decimal.Parse(irn_id) + ",+'" + lb2.Text + "',null,2)"; WebTools.ExeSql(q); } if (chk3.Checked == true) { string q = "INSERT INTO PIP_PO_IRN_RESULT(IRN_ID, RESULT_TEXT, REMARKS, IRN_RESULT_ID) VALUES(" + decimal.Parse(irn_id) + ",+'" + lb3.Text + "',null,3)"; WebTools.ExeSql(q); } if (chk4.Checked == true) { string q = "INSERT INTO PIP_PO_IRN_RESULT(IRN_ID, RESULT_TEXT, REMARKS, IRN_RESULT_ID) VALUES(" + decimal.Parse(irn_id) + ",+'" + lb4.Text + txtchk4.Text + "','" + txtchk4.Text + "',4)"; WebTools.ExeSql(q); } if (chk5.Checked == true) { string q = "INSERT INTO PIP_PO_IRN_RESULT(IRN_ID, RESULT_TEXT, REMARKS, IRN_RESULT_ID) VALUES(" + decimal.Parse(irn_id) + ",+'" + lb5.Text + "',null,5)"; WebTools.ExeSql(q); } if (chk6.Checked == true) { string q = "INSERT INTO PIP_PO_IRN_RESULT(IRN_ID, RESULT_TEXT, REMARKS, IRN_RESULT_ID) VALUES(" + decimal.Parse(irn_id) + ",+'" + lb6.Text + "',null,6)"; WebTools.ExeSql(q); } if (chk7.Checked == true) { string q = "INSERT INTO PIP_PO_IRN_RESULT(IRN_ID, RESULT_TEXT, REMARKS, IRN_RESULT_ID) VALUES(" + decimal.Parse(irn_id) + ",+'" + txtchk7.Text + "','" + txtchk7.Text + "',7)"; WebTools.ExeSql(q); } //if (chk7.Checked == true) //{ // string[] chk7items = new string[txtchk7.Entries.Count]; // for (int i = 0; i < txtchk7.Entries.Count; i++) // { // chk7items[i] = txtchk7.Entries[i].Text; // string q = "INSERT INTO PIP_PO_IRN_RESULT(IRN_ID, RESULT_TEXT, REMARKS, IRN_RESULT_ID) VALUES(" + decimal.Parse(irn_id) + ",+'" + txtchk7.Entries[i].Text + "','"+ txtchk7.Entries[i].Text+"',7)"; // WebTools.ExeSql(q); // } //} ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////------- string irn_no = WebTools.GetExpr("IRN_NO", "PIP_PO_IRN", " WHERE IRN_ID='" + irn_id + "'"); string proj_id = Session["PROJECT_ID"].ToString(); ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (txtFileUpload1.HasFile) { string Extension = Path.GetExtension(txtFileUpload1.PostedFile.FileName); string u_file_name = Path.GetFileName(txtFileUpload1.PostedFile.FileName); string FolderPath = WebTools.GetExpr("PATH", "DIR_OBJECTS", " WHERE DIR_ID=6"); string maxdoc = WebTools.CountExpr("IRN_ID", "PIP_PO_IR_DOCS", " WHERE IRN_ID=" + irn_id); int doccnt = 0; if (maxdoc == "") { doccnt = 1; } else { doccnt = int.Parse(maxdoc) + 1; } string irn_no2 = irn_no.Replace("/", "-"); u_file_name = u_file_name.Replace("'", ""); string Filename = irn_no2 + "_" + doccnt + Extension; string FilePath = FolderPath + Filename; txtFileUpload1.SaveAs(FilePath); string date1 = txtRepDate1.SelectedDate.ToString(); DateTime dt = DateTime.Parse(txtRepDate1.SelectedDate.ToString()); string query = "INSERT INTO PIP_PO_IR_DOCS(IRN_ID,DOC_NAME,DOC_EXT,DIR_ID,U_FILE_NAME,REPORT_NO,REP_DATE) VALUES(" + irn_id + ",'" + Filename + "','" + Extension + "','" + 6 + "','" + u_file_name + "','" + txtRep1.Text + "','" + dt.ToString("dd-MMM-yyyy") + "')"; WebTools.ExeSql(query); } /////////2 if (txtFileUpload2.HasFile) { string Extension = Path.GetExtension(txtFileUpload2.PostedFile.FileName); string u_file_name = Path.GetFileName(txtFileUpload2.PostedFile.FileName); string FolderPath = WebTools.GetExpr("PATH", "DIR_OBJECTS", " WHERE DIR_ID=6"); string maxdoc = WebTools.CountExpr("IRN_ID", "PIP_PO_IR_DOCS", " WHERE IRN_ID=" + irn_id); int doccnt = 0; if (maxdoc == "") { doccnt = 1; } else { doccnt = int.Parse(maxdoc) + 1; } string irn_no2 = irn_no.Replace("/", "-"); u_file_name = u_file_name.Replace("'", ""); string Filename = irn_no2 + "_" + doccnt + Extension; string FilePath = FolderPath + Filename; txtFileUpload2.SaveAs(FilePath); string date1 = txtRepDate2.SelectedDate.ToString(); DateTime dt = DateTime.Parse(txtRepDate2.SelectedDate.ToString()); string query = "INSERT INTO PIP_PO_IR_DOCS(IRN_ID,DOC_NAME,DOC_EXT,DIR_ID,U_FILE_NAME,REPORT_NO,REP_DATE) VALUES(" + irn_id + ",'" + Filename + "','" + Extension + "','" + 6 + "','" + u_file_name + "','" + txtRep2.Text + "','" + dt.ToString("dd-MMM-yyyy") + "')"; WebTools.ExeSql(query); } //////3 if (txtFileUpload3.HasFile) { string Extension = Path.GetExtension(txtFileUpload3.PostedFile.FileName); string u_file_name = Path.GetFileName(txtFileUpload3.PostedFile.FileName); string FolderPath = WebTools.GetExpr("PATH", "DIR_OBJECTS", " WHERE DIR_ID=6"); string maxdoc = WebTools.CountExpr("IRN_ID", "PIP_PO_IR_DOCS", " WHERE IRN_ID=" + irn_id); int doccnt = 0; if (maxdoc == "") { doccnt = 1; } else { doccnt = int.Parse(maxdoc) + 1; } string irn_no2 = irn_no.Replace("/", "-"); u_file_name = u_file_name.Replace("'", ""); string Filename = irn_no2 + "_" + doccnt + Extension; string FilePath = FolderPath + Filename; txtFileUpload3.SaveAs(FilePath); string date1 = txtRepDate3.SelectedDate.ToString(); DateTime dt = DateTime.Parse(txtRepDate3.SelectedDate.ToString()); string query = "INSERT INTO PIP_PO_IR_DOCS(IRN_ID,DOC_NAME,DOC_EXT,DIR_ID,U_FILE_NAME,REPORT_NO,REP_DATE) VALUES(" + irn_id + ",'" + Filename + "','" + Extension + "','" + 6 + "','" + u_file_name + "','" + txtRep3.Text + "','" + dt.ToString("dd-MMM-yyyy") + "')"; WebTools.ExeSql(query); } //////4 if (txtFileUpload4.HasFile) { string Extension = Path.GetExtension(txtFileUpload4.PostedFile.FileName); string u_file_name = Path.GetFileName(txtFileUpload4.PostedFile.FileName); string FolderPath = WebTools.GetExpr("PATH", "DIR_OBJECTS", " WHERE DIR_ID=6"); string maxdoc = WebTools.CountExpr("IRN_ID", "PIP_PO_IR_DOCS", " WHERE IRN_ID=" + irn_id); int doccnt = 0; if (maxdoc == "") { doccnt = 1; } else { doccnt = int.Parse(maxdoc) + 1; } string irn_no2 = irn_no.Replace("/", "-"); u_file_name = u_file_name.Replace("'", ""); string Filename = irn_no2 + "_" + doccnt + Extension; string FilePath = FolderPath + Filename; txtFileUpload4.SaveAs(FilePath); string date1 = txtRepDate4.SelectedDate.ToString(); DateTime dt = DateTime.Parse(txtRepDate4.SelectedDate.ToString()); string query = "INSERT INTO PIP_PO_IR_DOCS(IRN_ID,DOC_NAME,DOC_EXT,DIR_ID,U_FILE_NAME,REPORT_NO,REP_DATE) VALUES(" + irn_id + ",'" + Filename + "','" + Extension + "','" + 6 + "','" + u_file_name + "','" + txtRep4.Text + "','" + dt.ToString("dd-MMM-yyyy") + "')"; WebTools.ExeSql(query); } //5 if (txtFileUpload5.HasFile) { string Extension = Path.GetExtension(txtFileUpload5.PostedFile.FileName); string u_file_name = Path.GetFileName(txtFileUpload5.PostedFile.FileName); string FolderPath = WebTools.GetExpr("PATH", "DIR_OBJECTS", " WHERE DIR_ID=6"); string maxdoc = WebTools.CountExpr("IRN_ID", "PIP_PO_IR_DOCS", " WHERE IRN_ID=" + irn_id); int doccnt = 0; if (maxdoc == "") { doccnt = 1; } else { doccnt = int.Parse(maxdoc) + 1; } string irn_no2 = irn_no.Replace("/", "-"); u_file_name = u_file_name.Replace("'", ""); string Filename = irn_no2 + "_" + doccnt + Extension; string FilePath = FolderPath + Filename; txtFileUpload5.SaveAs(FilePath); string date1 = txtRepDate5.SelectedDate.ToString(); DateTime dt = DateTime.Parse(txtRepDate5.SelectedDate.ToString()); string query = "INSERT INTO PIP_PO_IR_DOCS(IRN_ID,DOC_NAME,DOC_EXT,DIR_ID,U_FILE_NAME,REPORT_NO,REP_DATE) VALUES(" + irn_id + ",'" + Filename + "','" + Extension + "','" + 6 + "','" + u_file_name + "','" + txtRep5.Text + "','" + dt.ToString("dd-MMM-yyyy") + "')"; WebTools.ExeSql(query); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Master.ShowSuccess("IRN Created"); } catch (Exception ex) { Master.ShowError(ex.Message); } }
protected void btnTextDataUpdate_Click(object sender, ImageClickEventArgs e) { try { //sg_text_imported_records string query6 = "BEGIN EXECUTE IMMEDIATE('TRUNCATE TABLE SG_TEXT_IMPORTED_RECORDS'); END;"; WebTools.ExeSql(query6); string query = "BEGIN EXECUTE IMMEDIATE('TRUNCATE TABLE SG_IMPORT_ERROR'); END;"; WebTools.ExeSql(query); string[] import_types = { "SPOOLINFO", "CUTLIST", "WELD", "SITEASSY", "LOM" }; try { //Settings WebTools.ExeSql("UPDATE project_setting SET sg_ignore_and_log__error='" + (chkIgnoreImportError.Checked ? "Y" : "N") + "'" + ", sg_define_new_iso='" + (chkDefineNewIso.Checked ? "Y" : "N") + "', sg_ignore_imported_iso='" + (chkDontUploadImportedISO.Checked ? "Y" : "N") + "'" + "WHERE project_id=" + Session["PROJECT_ID"].ToString()); //Loop through each directory foreach (string import_type in import_types) { //Get destination table names string table_name = import_type == "CUTLIST" ? "SG_CUT_LIST" : import_type == "LOM" ? "SG_MAT_CONTROL" : import_type == "WELD" ? "SG_WELDING" : import_type == "SPOOLINFO" ? "SG_SPL_INFO" : import_type == "SITEASSY" ? "SG_SITE_ASSEMBLY" : "DUAL"; //sg_text_location = WebTools.GetExpr("PATH", "DIR_OBJECTS", "DIR_OBJ='SG_DATA_TEXT'"); string file_location = sg_text_location + import_type + "\\"; //Loop through each files in the directory // string file_location = MoveToNewDirectory(import_type); foreach (string strFile in Directory.GetFiles(file_location)) { FileInfo fi = new FileInfo(strFile); string full_FileName = fi.FullName; string FileName = fi.Name; using (StreamReader reader = new StreamReader(full_FileName)) { string line = ""; while ((line = reader.ReadLine()) != null) { line = line.Replace("'", ""); //lblMessage.Text = line + "</BR>"; try { WebTools.ExeSql("INSERT INTO sg_text_imported_records(record_row, import_type, file_name)VALUES('" + line + "','" + import_type + "','" + FileName + "')"); } catch (Exception exc) { WebTools.exec_non_qry("INSERT INTO SG_IMPORT_ERROR(PROJECT_ID, FILE_NAME, ERROR_MSG, IMPORT_TYPE) " + " VALUES('1', '" + FileName + "', 'During import : " + exc.Message + "', '" + import_type + "')"); Master.ShowError(exc.Message); return; } } } } } string query7 = "BEGIN EXECUTE IMMEDIATE('TRUNCATE TABLE SG_IMPORT_ERR'); END;"; WebTools.ExeSql(query7); string query1 = "BEGIN EXECUTE IMMEDIATE('TRUNCATE TABLE SG_CUT_LIST'); END;"; WebTools.ExeSql(query1); string query2 = "BEGIN EXECUTE IMMEDIATE('TRUNCATE TABLE SG_MAT_CONTROL'); END;"; WebTools.ExeSql(query2); string query3 = "BEGIN EXECUTE IMMEDIATE('TRUNCATE TABLE SG_SITE_ASSEMBLY'); END;"; WebTools.ExeSql(query3); string query4 = "BEGIN EXECUTE IMMEDIATE('TRUNCATE TABLE SG_SPL_INFO'); END;"; WebTools.ExeSql(query4); string query5 = "BEGIN EXECUTE IMMEDIATE('TRUNCATE TABLE SG_WELDING'); END;"; WebTools.ExeSql(query5); } catch (Exception exc) { Master.ShowError(exc.Message); } try { WebTools.ExeSql("BEGIN PROC_UPDATE_SG_UPLOADED (" + Session["PROJECT_ID"].ToString() + "); END;"); WebTools.ExeSql("BEGIN update_sg_data; END;"); } catch (Exception ex) { lblMessage.Text = "<font color='red'>" + ex.Message + "</font>"; return; } //ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Spoolgen Text Imported Successfully!!!');", true); string errors = WebTools.CountExpr("ERROR_MSG", "SG_IMPORT_ERROR", "PROJECT_ID=" + Session["PROJECT_ID"].ToString()); string errors2 = WebTools.CountExpr("SQL_ERROR", "packaged_exceptions", "PACKAGE_NAME='PKG_UPDATE_SG_DATA'"); string total_errors = (Convert.ToInt32(errors) + Convert.ToInt32(errors2)).ToString(); if (total_errors.Equals("0")) { lblMessage.Text = "Spoolgen Text Imported Successfully!! Please proceed for Server Updates!"; //btnTextDataUpdate.Visible = false; } else { lblMessage.Text = "<font color='red'>" + total_errors + " error(s) occured during import !" + "</font>"; //WebTools.ExportDataSetToExcel(SqlDataSource1, "SgImportErrorLog.xls"); } } catch (Exception ex) { lblMessage.Text = "<font color='red'>" + ex.Message + "</font>"; return; } }
protected void btnImport_Click(object sender, EventArgs e) { try { if (RadAsyncUpload1.UploadedFiles.Count == 0 && RadAsyncUpload2.UploadedFiles.Count == 0) { Master.show_error("Please Upload File to proceed."); return; } if (Request.QueryString["REF_ID"] == "") { Master.show_error("Select Request Number To Upload"); return; } /////////////////////////////////////////////////////////////////////////////////////////////////////// if (RadAsyncUpload1.UploadedFiles.Count > 0) { int type_id = int.Parse(Request.QueryString["TYPE_ID"]); int ref_id = int.Parse(Request.QueryString["REF_ID"].ToString()); string proj_id = Session["PROJECT_ID"].ToString(); string user_id = WebTools.GetExpr("USER_ID", "USERS", " USER_NAME ='" + Session["USER_NAME"] + "'"); string f_name = ""; string dir_obj = ""; string dir_id = ""; string delquery = ""; // string irn_id = itemsGrid.SelectedValue.ToString(); switch (type_id) { case 1: f_name = WebTools.GetExpr("REQ_NO", "PIP_MAT_SUBSTITUTE", " WHERE REQ_ID='" + ref_id + "'"); dir_obj = "MAT_SUBSTITUTE"; delquery = "DELETE FROM PIP_FILE_UPLOAD WHERE type_id=" + type_id + " AND REF_ID=" + ref_id; WebTools.ExeSql(delquery); dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; } f_name = f_name.Replace("/", "-"); string Extension = Path.GetExtension(RadAsyncUpload1.UploadedFiles[0].GetExtension()); string FileName = f_name + Extension; string u_file_name = Path.GetFileName(RadAsyncUpload1.UploadedFiles[0].GetNameWithoutExtension()); string FolderPath = WebTools.GetExpr("PATH", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); string FilePath = FolderPath + FileName; System.IO.File.Delete(FilePath); RadAsyncUpload1.UploadedFiles[0].SaveAs(FilePath); string query = "INSERT INTO PIP_FILE_UPLOAD(TYPE_ID,REF_ID,DOC_NAME,DOC_EXT,DIR_ID,U_FILE_NAME,CREATED_BY) VALUES(" + type_id + "," + ref_id + ",'" + FileName + "','" + Extension + "','" + dir_id + "','" + u_file_name + "'," + decimal.Parse(user_id) + ")"; WebTools.ExeSql(query); Master.show_success("File Uploaded"); } if (RadAsyncUpload2.UploadedFiles.Count > 0) { int type_id = int.Parse(Request.QueryString["TYPE_ID"]); int ref_id = int.Parse(Request.QueryString["REF_ID"].ToString()); string proj_id = Session["PROJECT_ID"].ToString(); string user_id = WebTools.GetExpr("USER_ID", "USERS", " USER_NAME ='" + Session["USER_NAME"] + "'"); int filecount = RadAsyncUpload2.UploadedFiles.Count; string maxdoc = WebTools.CountExpr("REF_ID", "PIP_SUPP_FILE_UPLOAD", " WHERE TYPE_ID = " + type_id + " AND REF_ID = " + ref_id); int doccnt = 0; if (maxdoc == "") { doccnt = 1; } else { doccnt = int.Parse(maxdoc) + 1; } for (int i = 0; i < filecount; i++) { string f_name = ""; string dir_obj = ""; string dir_id = ""; // string irn_id = itemsGrid.SelectedValue.ToString(); switch (type_id) { case 1: f_name = WebTools.GetExpr("REQ_NO", "PIP_MAT_SUBSTITUTE", " WHERE REQ_ID='" + ref_id + "'"); dir_obj = "MAT_SUBST_SUPP"; dir_id = WebTools.GetExpr("DIR_ID", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); break; } f_name = f_name.Replace("/", "-"); string Extension = Path.GetExtension(RadAsyncUpload2.UploadedFiles[i].GetExtension()); string FileName = f_name + "_" + doccnt++ + Extension; string u_file_name = Path.GetFileName(RadAsyncUpload2.UploadedFiles[i].GetNameWithoutExtension()); u_file_name = u_file_name.Replace("'", ""); string FolderPath = WebTools.GetExpr("PATH", "DIR_OBJECTS", " WHERE DIR_OBJ='" + dir_obj + "'"); string FilePath = FolderPath + FileName; RadAsyncUpload2.UploadedFiles[i].SaveAs(FilePath); string query = "INSERT INTO PIP_SUPP_FILE_UPLOAD(TYPE_ID,REF_ID,DOC_NAME,DOC_EXT,DIR_ID,U_FILE_NAME,CREATED_BY) VALUES(" + type_id + "," + ref_id + ",'" + FileName + "','" + Extension + "','" + dir_id + "','" + u_file_name + "'," + decimal.Parse(user_id) + ")"; WebTools.ExeSql(query); Master.show_success("Files Uploaded"); } } } catch (Exception ex) { Master.show_error(ex.Message); } }
protected void btnSave_Click(object sender, EventArgs e) { try { string tc_id = ""; if (txtAutoMTCCode.Entries.Count > 0) { string po_id = WebTools.GetExpr("PO_ID", "PRC_MAT_INSP", " MIR_ID='" + Session["popUp_MIR_ID"].ToString() + "'"); tc_id = WebTools.GetExpr("TC_ID", "PIP_TEST_CARDS", " UPPER(TC_CODE) = '" + txtAutoMTCCode.Entries[0].Text.ToUpper() + "' and PO_ID = '" + po_id + "'"); if (tc_id.Trim().Length == 0) { //Register New MTC Code. string sql = "INSERT INTO PIP_TEST_CARDS (PROJECT_ID, TC_CODE, PO_ID) VALUES ('" + Session["PROJECT_ID"].ToString() + "', '" + txtAutoMTCCode.Entries[0].Text.Trim() + "','" + po_id + "')"; WebTools.ExeSql(sql); //Get TC_ID for New MTC Code tc_id = WebTools.GetExpr("TC_ID", "PIP_TEST_CARDS", " UPPER(TC_CODE) = '" + txtAutoMTCCode.Entries[0].Text.ToUpper() + "'"); } } else { Master.show_error("MTC Number cannot be blank."); return; } string mat_id = WebTools.GetExpr("MAT_ID", "PIP_MAT_STOCK", " MAT_CODE1='" + txtMatCode.Text + "'"); string itemid = WebTools.GetExpr("ITEM_ID", "PIP_MAT_STOCK", " MAT_ID= " + mat_id); if (itemid != "19") { if (txtAcptQty.Text.ToString().IndexOf('.') > 0 || txtRcvQty.Text.ToString().IndexOf('.') > 0) { Master.show_error("Selected Item cannot be in received in decimal Qty. <br/>Please Enter Integer Value."); return; } } if (decimal.Parse(txtAcptQty.Text.ToString()) > decimal.Parse(txtRcvQty.Text.ToString())) { Master.show_error("Accepted quantity cannot be more than received qty. <br/>Please re-check and enter valid value."); return; } decimal?substore_id = null; if (ddlSubStorList.SelectedIndex > 0) { substore_id = decimal.Parse(ddlSubStorList.SelectedValue); } string heat_no = string.Empty; if (txtAutoHeatNo.Entries.Count == 0) { heat_no = ""; } else { heat_no = txtAutoHeatNo.Entries[0].Text; } string sql1 = ""; sql1 = "INSERT INTO PRC_MAT_INSP_DETAIL(MIR_ID, PO_ITEM, MIR_ITEM, MAT_ID, RCV_QTY, ACPT_QTY, HEAT_NO, PAINT_SYS, TC_ID, SUBSTORE_ID, REMARKS,CEVALUE, AS_PER_PL_QTY, EXC_QTY, SH_QTY, DAMAG_QTY) "; sql1 += "VALUES('" + Session["popUp_MIR_ID"].ToString() + "', '" + txtPOItemNO.Text + "','" + txtMIRItemNo.Text + "','" + mat_id + "','"; sql1 += txtRcvQty.Text + "','" + txtAcptQty.Text + "','" + heat_no + "','" + txtPS.Text + "','" + tc_id + "','" + substore_id + "','"; sql1 += txtRemarks.Text + "','', '', '" + txtExcessQty.Text + "','" + txtShortage.Text + "','" + txtDamage.Text + "')"; // Master.show_success(sql1); WebTools.ExeSql(sql1); string query = string.Empty; try { //Update SRN No string srn_no = WebTools.GetExpr("SRN_NO", "PRC_MAT_INSP", " WHERE MIR_ID='" + Session["popUp_MIR_ID"].ToString() + "'"); string srn_no1 = string.Empty; string[] srn; if (srn_no.Contains(',')) { srn = srn_no.Split(','); string po_id = WebTools.GetExpr("PO_ID", "PRC_MAT_INSP", " WHERE MIR_ID='" + Session["popUp_MIR_ID"].ToString() + "'"); string count = WebTools.CountExpr("DISTINCT SRN_NO", "PIP_PO_SPLIT_DETAIL", " WHERE PO_ID = '" + po_id + "' AND PO_ITEM = '" + txtPOItemNO.Text + "'"); if (decimal.Parse(count) == 1) { srn_no1 = WebTools.DMaxText("SRN_NO", "PIP_PO_SPLIT_DETAIL", " WHERE PO_ID = '" + po_id + "' AND PO_ITEM = '" + txtPOItemNO.Text + "'"); } else { for (int i = 0; i < srn.Length; i++) { srn_no1 = WebTools.DMaxText("SRN_NO", "PIP_PO_SPLIT_DETAIL", " WHERE PO_ID = '" + po_id + "' AND PO_ITEM = '" + txtPOItemNO.Text + "' AND SRN_NO='" + srn[i] + "'"); if (srn_no1.Length > 0) { break; } } } } else { srn_no1 = srn_no; } query = "UPDATE PRC_MAT_INSP_DETAIL SET SRN_NO = '" + srn_no1 + "' WHERE MIR_ID = '" + Session["popUp_MIR_ID"].ToString() + "' " + " AND MIR_ITEM='" + txtMIRItemNo.Text + "'"; WebTools.ExeSql(query); } catch (Exception ex) { //Don't do anything } Master.show_success(txtMatCode.Text + " Added Successfully."); //Master.show_success(query); } catch (Exception ex) { Master.show_error(ex.Message); } }
protected string collect_pdfs(string source_directory, string target_directory, string specific_file) { string message = null; int Total = Directory.GetFiles(source_directory).Count(); RadProgressContext progress = RadProgressContext.Current; progress.Speed = "N/A"; int i = 1; //non replacement drawings try { foreach (string f in Directory.GetFiles(source_directory)) { progress.PrimaryTotal = 1; progress.PrimaryValue = 1; progress.PrimaryPercent = 100; progress.SecondaryTotal = Total; progress.SecondaryValue = i; progress.SecondaryPercent = Math.Round((double)(i * 100 / Total), 0); progress.CurrentOperationText = "Step " + i.ToString(); if (!Response.IsClientConnected) { //Cancel button was clicked or the browser was closed, so stop processing break; } progress.TimeEstimated = (Total - i) * 100; //Stall the current thread for 0.1 seconds System.Threading.Thread.Sleep(100); string file_name = f.Replace(source_directory, "").Replace("\\", "").ToUpper(); //CHECK if pdf name does not contain SPL then its ISO pdf also ignore PDFs with transmittal name if (specific_file.Equals("ISO_SPOOLGEN")) { if (file_name.Contains(".PDF") && !file_name.Contains("_SPL-") && WebTools.CountExpr("SERIAL_NO", "PIP_DWG_TRANS", "SERIAL_NO='" + file_name.Replace(".PDF", "") + "'").Equals("0")) { if (!File.Exists(target_directory + file_name)) { File.Copy(f, target_directory + file_name, true); } } } else if (specific_file.Equals("SPL_SPOOLGEN")) { if (file_name.Contains(".PDF") && file_name.Contains("_SPL-")) { if (!File.Exists(target_directory + file_name)) { File.Copy(f, target_directory + file_name, true); } } } else if (specific_file.Equals("ISO_HARDCOPY")) { if (file_name.EndsWith(".PDF") && !WebTools.CountExpr("ISO_TITLE1", "PIP_ISOMETRIC", "'" + file_name.Replace(".PDF", "") + "' LIKE ISO_TITLE1||'%'").Equals("0")) { if (!File.Exists(target_directory + file_name)) { File.Copy(f, target_directory + file_name, true); } } } else if (specific_file.Equals("MTC_PDF")) { if (file_name.EndsWith(".PDF") && !WebTools.CountExpr("TC_CODE", "TEST_CERTIFICATE", "'" + file_name.Replace(".PDF", "") + "' LIKE TC_CODE||'%'").Equals("0")) { if (!File.Exists(target_directory + file_name)) { File.Copy(f, target_directory + file_name, true); } } } i++; } //foreach (string subDir in Directory.GetDirectories(@source_directory)) //{ // collect_pdfs(subDir, target_directory, specific_file); //} Master.show_success("PDFs collected successfully ! Please proceed for flag update!"); } catch (Exception ex) { message = "<font color='red'>" + ex.Message + "</font>"; } return(message); }
private void RefreshButtons() { string amg_import = "~/Import_Format/AmoghSgImport/"; string Epic_import = "~/Import_Format/EpicSgImport/"; string dir_obj = importformat.SelectedValue.ToString(); if (dir_obj == "AMOGH_DATA_IMPORT") { HyperLink1.NavigateUrl = amg_import + "CUTLIST.xlsx"; HyperLink2.NavigateUrl = amg_import + "SPOOL.xlsx"; HyperLink3.NavigateUrl = amg_import + "JOINT.xlsx"; HyperLink4.NavigateUrl = amg_import + "LOM.xlsx"; HyperLink5.NavigateUrl = amg_import + "SITEJOINT.xlsx"; txtAmoghOutput.Visible = true; txtEpicOutput.Visible = false; string cutlist_cnt = WebTools.CountExpr("IMPORT_REMARKS", "CLIENT_CUT_LIST_AMOGH", " WHERE IMPORT_REMARKS IS NOT NULL "); string spl_cnt = WebTools.CountExpr("IMPORT_REMARKS", "CLIENT_SPOOL_AMOGH", " WHERE IMPORT_REMARKS IS NOT NULL "); string jnt_cnt = WebTools.CountExpr("IMPORT_REMARKS", "CLIENT_JOINT_AMOGH", " WHERE IMPORT_REMARKS IS NOT NULL "); string lom_cnt = WebTools.CountExpr("IMPORT_REMARKS", "CLIENT_LOM_AMOGH", " WHERE IMPORT_REMARKS IS NOT NULL "); string siteJnt_cnt = WebTools.CountExpr("IMPORT_REMARKS", "CLIENT_SITE_JOINT_AMOGH", " WHERE IMPORT_REMARKS IS NOT NULL "); if (cutlist_cnt != "0") { btnCutlist.Visible = true; } else { btnCutlist.Visible = false; } if (spl_cnt != "0") { btnSpool.Visible = true; } else { btnSpool.Visible = false; } if (jnt_cnt != "0") { btnJoint.Visible = true; } else { btnJoint.Visible = false; } if (lom_cnt != "0") { btnLom.Visible = true; } else { btnLom.Visible = false; } if (siteJnt_cnt != "0") { btnFlange.Visible = true; } else { btnFlange.Visible = false; } } if (dir_obj == "EPIC_DATA_IMPORT") { HyperLink6.NavigateUrl = Epic_import + "SPOOL_EPIC.xlsx"; HyperLink7.NavigateUrl = Epic_import + "JOINT_EPIC.xlsx"; HyperLink8.NavigateUrl = Epic_import + "BOM_EPIC.xlsx"; txtEpicOutput.Visible = true; txtAmoghOutput.Visible = false; string spl_cnt = WebTools.CountExpr("IMPORT_REMARKS", "CLIENT_SPOOL_DATA_EPIC", " WHERE IMPORT_REMARKS IS NOT NULL "); string jnt_cnt = WebTools.CountExpr("IMPORT_REMARKS", "CLIENT_JOINT_EPIC", " WHERE IMPORT_REMARKS IS NOT NULL "); string lom_cnt = WebTools.CountExpr("IMPORT_REMARKS", "CLIENT_BOM_N_JC_EPIC", " WHERE IMPORT_REMARKS IS NOT NULL "); if (spl_cnt != "0") { btnEpicSpool.Visible = true; } else { btnEpicSpool.Visible = false; } if (jnt_cnt != "0") { btnEpicJoint.Visible = true; } else { btnEpicJoint.Visible = false; } if (lom_cnt != "0") { btnEpicBom.Visible = true; } else { btnEpicBom.Visible = false; } } }