Beispiel #1
0
    protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
    {
        if (e.CommandName == "Update")
        {
            try
            {
                GridDataItem item = e.Item as GridDataItem;

                string JOINT_ID, WELDER_ID, PASS_ID, new_welder_id;
                object REWORK_CODE;

                JOINT_ID    = item.GetDataKeyValue("JOINT_ID").ToString();
                REWORK_CODE = item.GetDataKeyValue("REWORK_CODE");
                WELDER_ID   = item.GetDataKeyValue("WELDER_ID").ToString();
                PASS_ID     = item.GetDataKeyValue("PASS_ID").ToString();

                new_welder_id = (item["WELDER_NO"].FindControl("ddlWelderEdit") as RadDropDownList).SelectedValue;

                string sql = "UPDATE PIP_SPOOL_WELDING SET WELDER_ID = '" + new_welder_id + "'";
                sql += " WHERE JOINT_ID = " + JOINT_ID + " AND REPAIR_CODE = '" + REWORK_CODE + "'";
                sql += " AND WELDER_ID = '" + WELDER_ID + "' AND PASS_ID = '" + PASS_ID + "'";
                WebTools.ExecNonQuery(sql);
                Master.show_success("Updated.");
            }
            catch (Exception ex)
            {
                Master.show_error(ex.Message);
            }
            finally {
                RadGrid1.Rebind();
            }
        }
    }
    protected void btnImport_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);

        // delete old data
        WebTools.ExecNonQuery("DELETE FROM PIP_ISOMETRIC_IMPORT WHERE PROJECT_ID IN (0, -1, " + proj_id + ")");

        ExcelImport.Import_Excel_File(FilePath, Extension, "PIP_ISOMETRIC_IMPORT", "PIP_ISOMETRIC_IMPORT_PK",
                                      "PROJECT_ID", Session["PROJECT_ID"].ToString());

        WebTools.ExecNonQuery("BEGIN PKG_IMPORT_ISO.PRC_IMPORT_ISO(" + proj_id + ");END;");

        Master.ShowSuccess("Isometric list imported!");
    } // method
    protected void btnImport_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);

        // delete old data
        WebTools.ExecNonQuery("DELETE FROM IMPORT_CMS_SPL_AVL WHERE PROJECT_ID IN (0, -1, " + Session["PROJECT_ID"].ToString() + ")");

        FileStream stream = new FileStream(FilePath, FileMode.Open, FileAccess.Read);

        ExcelImport.ImporNpoi(stream, "IMPORT_CMS_SPL_AVL", "PK_IMPORT_CMS_SPL_AVL", "PROJECT_ID", proj_id);

        WebTools.ExecNonQuery("BEGIN PKG_IMPORT_CMS_SPL_AVL.UPDATE_SPOOL(" + Session["PROJECT_ID"].ToString() + ");END;");

        Master.ShowSuccess("CMS Material Available Status imported!");
    } // method
Beispiel #4
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string SQL = "INSERT INTO SITE_REMAINING_WORK(PROJECT_ID, JC_ID, SUB_CON_ID, ISO_ID, SHEET, PUNCH_CODE,";

        SQL += "ITEM_DESC, PUNCH_CAT, BOM_ID, SPOOL, REMARKS) VALUES(" + Session["PROJECT_ID"].ToString();

        SQL += "," + ddJC_NO.SelectedValue.ToString() + "," + ddSubcon.SelectedValue.ToString();
        SQL += "," + cboIsome.SelectedValue.ToString();
        SQL += ",'" + ddSheetNo.SelectedValue.ToString() + "'";
        SQL += ",'" + ddPunchCode.SelectedItem.Text + "'";
        SQL += ",'" + txtDesc.Text + "'";
        SQL += ",'" + ddPunchCat.SelectedValue.ToString() + "'";
        SQL += "," + (cboBOM.SelectedValue.ToString() != "-1" ? cboBOM.SelectedValue.ToString() : "NULL");
        SQL += ",'" + ddSpool.SelectedValue.ToString() + "'";
        SQL += ",'" + txtRemarks.Text + "'";
        SQL += ")";

        try
        {
            WebTools.ExecNonQuery(SQL);
            welderGridView.DataBind();
            Master.ShowMessage("Saved!");
        }
        catch (Exception ex)
        {
            Master.ShowWarn(ex.Message);
        }
    }
Beispiel #5
0
    protected void UploadETAFile()
    {
        try
        {
            string proj_id    = Session["PROJECT_ID"].ToString();
            string FileName   = Path.GetFileName(matEtaUploader.PostedFile.FileName);
            string Extension  = Path.GetExtension(matEtaUploader.PostedFile.FileName);
            string FolderPath = WebTools.SessionDataPath();

            string FilePath = FolderPath + FileName;
            matEtaUploader.SaveAs(FilePath);

            // delete old data
            WebTools.ExecNonQuery("DELETE FROM TBL_TEMP_SML_MAT_ETA 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_TEMP_SML_MAT_ETA", "", "PROJECT_ID", proj_id);
        }
        catch (Exception ex)
        {
            Master.show_error("Error ETA File : " + ex.Message);
        }
    }
    protected void btnImport_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);

        // delete old data
        WebTools.ExecNonQuery("DELETE FROM PIP_MSR_IMPORT");
        WebTools.ExecNonQuery("DELETE FROM PIP_PO_DETAIL");
        WebTools.ExecNonQuery("DELETE FROM PIP_PO");

        FileStream stream = new FileStream(FilePath, FileMode.Open, FileAccess.Read);

        ExcelImport.ImporNpoi(stream, "PIP_MSR_IMPORT", "", "PROJECT_ID", proj_id);

        WebTools.ExecNonQuery("DELETE PIP_MSR_IMPORT WHERE PO_NO='TEXT' OR AMD_NO='TEXT' OR MATERIAL_DESCRIPTION1='TEXT'");
        WebTools.ExecNonQuery("UPDATE PIP_MSR_IMPORT SET MATERIAL_DESCRIPTION1=UPPER(MATERIAL_DESCRIPTION1)");
        WebTools.ExecNonQuery("UPDATE PIP_MSR_IMPORT SET MATERIAL_DESCRIPTION2=UPPER(MATERIAL_DESCRIPTION2)");
        WebTools.ExecNonQuery("UPDATE PIP_MSR_IMPORT SET IDENT_CD=MATERIAL_DESCRIPTION1 WHERE IDENT_CD IS NULL AND MATERIAL_DESCRIPTION1 IS NOT NULL");
        WebTools.ExecNonQuery("DELETE PIP_MSR_IMPORT WHERE IDENT_CD IS NULL");

        WebTools.ExecNonQuery("BEGIN PKG_IMPORT_PO.APPEND_PO(" + proj_id + ");END;");

        Master.ShowSuccess("PO imported!");
    } // method
    protected void btnRun_Click(object sender, EventArgs e)
    {
        StringBuilder sb        = new StringBuilder();
        string        set_param = "dbms_scheduler.set_job_argument_value(job_name => 'JOB_MAT_ALLOC_ALL', argument_position => {0}, argument_value => {1});";

        string arg_1 = Session["PROJECT_ID"].ToString();          // proj_id
        string arg_2 = rblReservableQty.SelectedValue.ToString(); // reservable qty
        string arg_3 = fieldAllocRadCheckBox.Checked == true ? "'Y'" : "'N'";
        string arg_4 = subconWiseRadCheckBox.Checked == true ? "'Y'" : "'N'";
        string arg_5 = currDeliveryRadCheckBox.Checked == true ? "'Y'" : "'N'";

        sb.Append("BEGIN");
        sb.AppendLine();
        sb.Append(string.Format(set_param, 1, arg_1));
        sb.AppendLine();
        sb.Append(string.Format(set_param, 2, arg_2));
        sb.AppendLine();
        sb.Append(string.Format(set_param, 3, arg_3));
        sb.AppendLine();
        sb.Append(string.Format(set_param, 4, arg_4));
        sb.AppendLine();
        sb.Append(string.Format(set_param, 5, arg_5));
        sb.AppendLine();
        sb.Append("dbms_scheduler.enable('JOB_MAT_ALLOC_ALL');");
        sb.AppendLine();
        sb.Append("END;");

        WebTools.ExecNonQuery(sb.ToString());

        Master.ShowSuccess("Allocation Started!");
    }
    protected void UploadFile(FileUpload f, string DestinationTable)
    {
        string proj_id    = Session["PROJECT_ID"].ToString();
        string FileName   = Path.GetFileName(f.PostedFile.FileName);
        string Extension  = Path.GetExtension(f.PostedFile.FileName);
        string FolderPath = WebTools.SessionDataPath();

        string FilePath = FolderPath + FileName;

        f.SaveAs(FilePath);

        // delete old data
        WebTools.ExecNonQuery("DELETE FROM " + DestinationTable + " WHERE PROJECT_ID = '" + Session["PROJECT_ID"].ToString() + "'");

        FileStream stream = new FileStream(FilePath, FileMode.Open, FileAccess.Read);

        DataTable dt = new DataTable();

        dt = ExcelImport.xlsxToDT2(stream);

        dt.Columns.Add("IMPORT_BY");

        foreach (DataRow r in dt.Rows)
        {
            r["IMPORT_BY"] = Session["USER_NAME"].ToString();
        }


        ExcelImport.ImportDataTable(dt, DestinationTable, "", "PROJECT_ID", proj_id);
    }
Beispiel #9
0
    private static void ImportSPS(string Extension, string FilePath, string proj_id)
    {
        WebTools.ExecNonQuery("DELETE FROM PIP_SUPP_MTO_SPS WHERE PROJECT_ID IN (0, -1, " + proj_id + ")");

        ExcelImport.Import_Excel_File(FilePath, Extension, "PIP_SUPP_MTO_SPS", "PK_SUPP_MTO_SPS", "PROJECT_ID", proj_id);

        WebTools.ExecNonQuery("DELETE FROM PIP_SUPP_MTO_SPS WHERE ITEM_NAME='TEXT' OR ITEM_TYPE='TEXT'");
    }
    private void ImportCccSpool(string Extension, string FilePath, string proj_id)
    {
        WebTools.ExecNonQuery("DELETE FROM CCC_IMPORT_SPOOL WHERE PROJECT_ID IN (0, -1, " + proj_id + ")");
        FileStream fs = new FileStream(FilePath, FileMode.Open);

        ExcelImport.ImporNpoi(fs, "CCC_IMPORT_SPOOL", "CCC_IMPORT_SPOOL_UK1", "PROJECT_ID", proj_id);
        WebTools.ExecNonQuery("DELETE FROM CCC_IMPORT_SPOOL WHERE ISO_TITLE1='TEXT' OR SPOOLNO='TEXT'");
        WebTools.ExecNonQuery("BEGIN PKG_CCC_IMPORT_MTO.PRC_IMPORT_SPL(" + proj_id + ");END;");
    }
Beispiel #11
0
    private static void ImportSuppMTO(string Extension, string FilePath, string proj_id)
    {
        WebTools.ExecNonQuery("DELETE FROM PIP_SUPP_MTO_LINE_ID WHERE PROJECT_ID IN (0, -1, " + proj_id + ")");

        ExcelImport.Import_Excel_File(FilePath, Extension, "PIP_SUPP_MTO_LINE_ID", "UK_PIP_SUPP_MTO_LINE_ID", "PROJECT_ID", proj_id);

        WebTools.ExecNonQuery("DELETE FROM PIP_SUPP_MTO_LINE_ID WHERE ITEM_NAME='TEXT' OR ITEM_TYPE='TEXT'");
        WebTools.ExecNonQuery("UPDATE PIP_SUPP_MTO_LINE_ID SET NOTE=UPPER(NOTE)");
        WebTools.ExecNonQuery("UPDATE PIP_SUPP_MTO_LINE_ID SET SCOPE_NAME=UPPER(SCOPE_NAME)");
        WebTools.ExecNonQuery("UPDATE PIP_SUPP_MTO_LINE_ID SET AREA_NAME=UPPER(AREA_NAME)");

        WebTools.ExecNonQuery("BEGIN PKG_UPDATE_SUPP_MTO.INSERT_MTO(" + proj_id + ");END;");
    }
Beispiel #12
0
    public void ImportTable(string table_name, string file_path, string project_field)
    {
        WebTools.ExecNonQuery("DELETE FROM " + table_name);
        FileStream stream;
        DataTable  dt;

        stream = new FileStream(file_path, FileMode.Open, FileAccess.Read);

        dt = new DataTable();
        dt = ExcelImport.xlsxToDT2(stream);


        ExcelImport.ImportDataTable(dt, table_name, "", project_field, "1");
    }
Beispiel #13
0
    protected void btnAutoNDE_Click(object sender, EventArgs e)
    {
        string nde_sql = "DECLARE outMSG VARCHAR2(100); BEGIN outMSG := FNC_SET_NDE_CMPLT_SPL(" +
                         Session["PROJECT_ID"].ToString() + "); END;";

        try
        {
            WebTools.ExecNonQuery(nde_sql);
            Master.ShowMessage("NDE Update Done Successfully!");
        }
        catch (Exception ex)
        {
            Master.ShowWarn(ex.Message);
        }
    }
    protected void btnImport_Click(object sender, EventArgs e)
    {
        try
        {
            if (RadAsyncUpload1.UploadedFiles.Count == 0)
            {
                Master.show_error("Please Upload File to proceed.");
                return;
            }

            string proj_id = Session["PROJECT_ID"].ToString();
            string user_id = WebTools.GetExpr("USER_ID", "USERS", " WHERE USER_NAME ='" + Session["USER_NAME"] + "'");
            //string FileName = Path.GetFileName(FileUpload1.PostedFile.FileName);
            //string Extension = Path.GetExtension(FileUpload1.PostedFile.FileName);
            string FolderPath = WebTools.SessionDataPath();
            string FileName   = Path.GetFileName(RadAsyncUpload1.UploadedFiles[0].FileName);
            string Extension  = Path.GetExtension(RadAsyncUpload1.UploadedFiles[0].FileName);
            string FilePath   = FolderPath + FileName;
            //FileUpload1.SaveAs(FilePath);
            RadAsyncUpload1.UploadedFiles[0].SaveAs(FilePath);
            // delete old data
            WebTools.ExecNonQuery("DELETE FROM PIP_PO_IMPORT WHERE PROJECT_ID = '" + Session["PROJECT_ID"].ToString() + "'");



            FileStream stream = new FileStream(FilePath, FileMode.Open, FileAccess.Read);

            DataTable dt = new DataTable();
            dt = ExcelImport.xlsxToDT2(stream);

            dt.Columns.Add("USER_ID");
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dt.Rows[i]["USER_ID"] = user_id;
            }

            ExcelImport.ImportDataTable(dt, "PIP_PO_IMPORT", "", "PROJECT_ID", proj_id);

            WebTools.ExecNonQuery("BEGIN PKG_BULK_IMPORT.PROC_PO_IMPORT('" + user_id + "') ; END;");

            Master.show_success("PO Data Imported Successfully.");
        }
        catch (Exception ex)
        {
            Master.show_error(ex.Message);
        }
    }
Beispiel #15
0
    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 btnUpdateDate_Click(object sender, EventArgs e)
    {
        if (DataTypeList.SelectedValue.ToString() == "1")
        {
            WebTools.ExecNonQuery("UPDATE PIP_ISOMETRIC SET EXPORT_DATE=TO_CHAR(SYSDATE, 'DD-MON-YYYY') WHERE EXPORT_DATE IS NULL AND PROJ_ID=" +
                                  Session["PROJECT_ID"].ToString() +
                                  " AND ISO_ID IN (SELECT DISTINCT ISO_ID FROM PIP_SPOOL)");
        }
        else
        {
            WebTools.ExecNonQuery("UPDATE PIP_SPOOL_JOINTS SET WELDING_EXPORT_DATE=TO_CHAR(SYSDATE, 'DD-MON-YYYY') " +
                                  "WHERE WELDING_EXPORT_DATE IS NULL AND JOINT_ID IN (SELECT JOINT_ID FROM PIP_SPOOL_WELDING)");

            WebTools.ExecNonQuery("UPDATE PIP_NDE_REQUEST_JOINTS SET NDE_EXPORT_DATE=TO_CHAR(SYSDATE, 'DD-MON-YYYY') " +
                                  "WHERE NDE_EXPORT_DATE IS NULL AND NDE_DATE IS NOT NULL");
        }

        Master.ShowSuccess("Update!");
    }
    protected void btnRun_Click(object sender, EventArgs e)
    {
        StringBuilder sb        = new StringBuilder();
        string        set_param = "dbms_scheduler.set_job_argument_value(job_name => 'JOB_UPDATE_SPL_BOM', argument_position => {0}, argument_value => {1});";

        string arg_1 = Session["PROJECT_ID"].ToString(); // proj_id

        sb.Append("BEGIN");
        sb.AppendLine();
        sb.Append(string.Format(set_param, 1, arg_1));
        sb.AppendLine();
        sb.Append("dbms_scheduler.enable('JOB_UPDATE_SPL_BOM');");
        sb.AppendLine();
        sb.Append("END;");

        WebTools.ExecNonQuery(sb.ToString());

        Master.ShowSuccess("Update MTO Started!");
    }
Beispiel #18
0
    protected void btnImport_Click(object sender, EventArgs e)
    {
        try
        {
            //if (!FileUpload1.HasFile) return;

            if (RadAsyncUpload1.UploadedFiles.Count == 0)
            {
                Master.show_error("Please Upload File to proceed.");
                return;
            }


            string user_id = WebTools.GetExpr("USER_ID", "USERS", "USER_NAME='" + Session["USER_NAME"].ToString() + "'");
            string proj_id = Session["PROJECT_ID"].ToString();

            string FolderPath = WebTools.SessionDataPath();
            string FileName   = Path.GetFileName(RadAsyncUpload1.UploadedFiles[0].FileName);
            string Extension  = Path.GetExtension(RadAsyncUpload1.UploadedFiles[0].FileName);
            string FilePath   = FolderPath + FileName;

            RadAsyncUpload1.UploadedFiles[0].SaveAs(FilePath);

            WebTools.ExecNonQuery("DELETE FROM PIP_BULK_JC_SHOP_IMPORT WHERE PROJECT_ID = '" + Session["PROJECT_ID"].ToString() + "' AND USER_ID=" + user_id);

            FileStream stream = new FileStream(FilePath, FileMode.Open, FileAccess.Read);

            DataTable dt = new DataTable();
            dt = ExcelImport.xlsxToDT2(stream);
            DataColumn user_id_col = new DataColumn("USER_ID", typeof(int));
            user_id_col.DefaultValue = int.Parse(user_id);
            dt.Columns.Add(user_id_col);

            ExcelImport.ImportDataTable(dt, "PIP_BULK_JC_SHOP_IMPORT", "", "PROJECT_ID", proj_id);
            Master.show_success("Proceed to check status");
            btnProceed.Visible = true;
        }
        catch (Exception ex)
        {
            Master.show_error(ex.Message);
        }
    }
    protected void btnImport_Click(object sender, EventArgs e)
    {
        try
        {
            //if (!FileUpload1.HasFile) return;

            if (RadAsyncUpload1.UploadedFiles.Count == 0)
            {
                Master.show_error("Please Upload File to proceed.");
                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 FileName   = Path.GetFileName(RadAsyncUpload1.UploadedFiles[0].FileName);
            string Extension  = Path.GetExtension(RadAsyncUpload1.UploadedFiles[0].FileName);
            string FilePath   = FolderPath + FileName;
            //FileUpload1.SaveAs(FilePath);
            RadAsyncUpload1.UploadedFiles[0].SaveAs(FilePath);
            // delete old data
            WebTools.ExecNonQuery("DELETE FROM TEMP_TBL_IDF_MTO 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, "TEMP_TBL_IDF_MTO", "", "PROJECT_ID", proj_id);

            WebTools.ExecNonQuery("BEGIN PKG_PAGE_VALIDATION.proc_update_idf_mto_data; END;");

            Master.show_success("IDF MTO Data Imported Successfully.");
        }
        catch (Exception ex)
        {
            Master.show_error(ex.Message);
        }
    }
Beispiel #20
0
    protected void btnUpload_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);

            if (RadioButtonList1.SelectedValue == "0")
            {
                // delete old data
                WebTools.ExecNonQuery("DELETE FROM PIP_PPCS_ADD_MAT 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, "PIP_PPCS_ADD_MAT", "", "PROJECT_ID", proj_id);


            Master.show_success("Data Imported Successfully.");
        }
        catch (Exception ex)
        {
            Master.show_error(ex.Message);
        }
    }
    protected void btnYes_Click(object sender, EventArgs e)
    {
        string bom_id    = itemsGridView.SelectedValues[1].ToString();
        string tag_no    = WebTools.GetExpr("MAT_CODE1", "VIEW_BOM_SIMPLE", "BOM_ID=" + bom_id);
        string mat_class = WebTools.GetExpr("MAT_CLASS", "VIEW_BOM_SIMPLE", "BOM_ID=" + bom_id);

        try
        {
            if (YesNoHiddenField.Value.ToString() == "1")
            {
                //Delete Row
                //itemsGridView.DeleteRow(itemsGridView.SelectedIndex);
                //Master.ShowMessage("Row deleted successfully!");
            }
            else if (YesNoHiddenField.Value.ToString() == "2")
            {
                //Update MTO
                WebTools.ExecNonQuery("DELETE FROM PIP_SUPP_BOM WHERE BOM_ID=" + bom_id);

                string result = WebTools.GetExpr(
                    "FNC_INSERT_SUPP_BOM('" + bom_id + "','" + tag_no + "','" + mat_class + "')", "DUAL", "");

                WebTools.ExecNonQuery(
                    "UPDATE PIP_SUPP_JC_DETAIL SET MTO_UPDATE_DATE=TO_CHAR(TO_DATE(SYSDATE), 'DD-MON-YYYY'), MTO_UPDATE_BY='" +
                    Session["USER_NAME"].ToString() + "' WHERE BOM_ID=" + bom_id + " AND JC_ID=" + itemsGridView.SelectedValues[0].ToString());

                Master.ShowSuccess("MTO Updated!");
            }
            else
            {
                Master.ShowMessage("Nothing Done!");
            }
        }
        catch (Exception ex)
        {
            Master.ShowWarn(ex.Message);
        }
    }
Beispiel #22
0
    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 PIP_LINE_MTO 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, "PIP_LINE_MTO", "", "PROJECT_ID", proj_id);

            WebTools.ExecNonQuery("BEGIN " +
                                  "PKG_PAGE_VALIDATION.UPDATE_LINE_MTO('" + Session["PROJECT_ID"].ToString() + "'); " +
                                  " END;");

            Master.show_success("LINE MTO Data Imported Successfully.");
        }
        catch (Exception ex)
        {
            Master.show_error(ex.Message);
        }
    }
Beispiel #23
0
    protected void btnImport_Click(object sender, EventArgs e)
    {
        if (FileUpload1.HasFile)
        {
            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 FIELD_WELDING_IMPORT WHERE PROJECT_ID=" + Session["PROJECT_ID"].ToString());

            //Import_Excel_File(FilePath, Extension, "Yes");
            ExcelImport.Import_Excel_File(FilePath, Extension, "FIELD_WELDING_IMPORT", "PK_FIELD_WELDING_IMPORT",
                                          "PROJECT_ID", Session["PROJECT_ID"].ToString());

            // update proj_id
            WebTools.ExecNonQuery("UPDATE FIELD_WELDING_IMPORT SET PROJECT_ID=" + Session["PROJECT_ID"].ToString() + " WHERE PROJECT_ID IS NULL");

            Save_Welding();
        }
    }
    protected void btnSaveRemainSerial_Click(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(txtRemainSerialNo.Text.Trim()))
        {
            WebTools.ExecNonQuery("UPDATE PIP_WORK_ORD_CUTLEN SET REM_ID=NULL WHERE PIECE_ID=" + itemsGridView.SelectedValue.ToString());
            itemsGridView.DataBind();
            return;
        }

        string sc_id  = WebTools.GetExpr("SC_ID", "VIEW_JC_MIV", "ISSUE_ID=" + Request.QueryString["ISSUE_ID"]);
        string rem_id = WebTools.GetExpr("REM_ID", "PIP_PIPE_REMAIN",
                                         string.Format("SC_ID={0} AND REM_SERIAL={1}", sc_id, txtRemainSerialNo.Text.Trim()));

        if (!string.IsNullOrEmpty(rem_id))
        {
            WebTools.ExecNonQuery("UPDATE PIP_WORK_ORD_CUTLEN SET REM_ID=" + rem_id + " WHERE PIECE_ID=" + itemsGridView.SelectedValue.ToString());
            itemsGridView.DataBind();
        }
        else
        {
            Master.ShowError("Remain Serial no not found!");
            return;
        }
    }
    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 btnImport_Click(object sender, EventArgs e)
    {
        try
        {
            //if (!FileUpload1.HasFile) return;

            if (RadAsyncUpload1.UploadedFiles.Count == 0)
            {
                Master.show_error("Please Upload File to proceed.");
                return;
            }


            string ImportOption = ImportOptions.SelectedValue;
            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 FileName   = Path.GetFileName(RadAsyncUpload1.UploadedFiles[0].FileName);
            string Extension  = Path.GetExtension(RadAsyncUpload1.UploadedFiles[0].FileName);
            string FilePath   = FolderPath + FileName;
            //FileUpload1.SaveAs(FilePath);
            RadAsyncUpload1.UploadedFiles[0].SaveAs(FilePath);
            // delete old data


            FileStream stream = new FileStream(FilePath, FileMode.Open, FileAccess.Read);

            DataTable dt = new DataTable();
            dt = ExcelImport.xlsxToDT2(stream);

            switch (ImportOption)
            {
            case "ADD":
                break;

            case "REPLACE":
                DataView view = new DataView(dt);
                DeleteExisting(view.ToTable(true, "IRN_NO"));
                break;

            case "REIMPORT":
                WebTools.ExecNonQuery("DELETE FROM PO_VENDOR_DATA WHERE PROJECT_ID = '" + Session["PROJECT_ID"].ToString() + "'");
                break;
            }

            dt.Columns.Add("CREATE_DATE");
            dt.Columns.Add("CREATE_BY");
            foreach (DataRow r in dt.Rows)
            {
                r["CREATE_DATE"] = System.DateTime.Today;
                r["CREATE_BY"]   = Session["USER_NAME"];
            }
            ExcelImport.ImportDataTable(dt, "PO_VENDOR_DATA", "", "PROJECT_ID", proj_id);

            //WebTools.ExecNonQuery("BEGIN PKG_PAGE_VALIDATION.proc_update_idf_mto_data; END;");

            Master.show_success("Vendor Data Imported Successfully.");
        }
        catch (Exception ex)
        {
            Master.show_error(ex.Message);
        }
    }
    protected void btnYes_Click(object sender, EventArgs e)
    {
        string result;

        if (modeField.Value.ToString() == "1")
        {
            //run the cut-lenght calculation
            string use_rem     = chkUseRem.Checked == true ? "'Y'" : "'N'";
            string use_extr    = chkUseExtra.Checked == true ? "'Y'" : "'N'";
            string pip_adj     = chkPipeAdj.Checked == true ? "'Y'" : "'N'";
            string cutting_alw = txtCuttingAlwMM.Text == string.Empty ? "0" : txtCuttingAlwMM.Text;

            WebTools.ExecNonQuery("UPDATE PIP_SPOOL SET MAT_TYPE=REPLACE(MAT_TYPE, ' - ', '-') WHERE MAT_TYPE LIKE '% - %'");
            WebTools.ExecNonQuery("UPDATE PIP_ISOMETRIC SET MAIN_MAT=REPLACE(MAIN_MAT, ' - ', '-') WHERE MAIN_MAT LIKE '% - %'");

            result = WebTools.GetExpr("FNC_CUTLEN_MAIN(" + Request.QueryString["ISSUE_ID"] +
                                      "," + use_rem +
                                      "," + pip_adj +
                                      "," + use_extr +
                                      "," + cboType.SelectedValue.ToString() +
                                      "," + cutting_alw +
                                      ")", "DUAL", "");

            if (string.IsNullOrEmpty(result))
            {
                result = "2";
            }

            if (result == "1")
            {
                Master.ShowMessage("Done!");
            }
            else
            {
                Master.ShowWarn("Error while calculating Cutting Plan!");
            }

            check_Err();
        }

        else if (modeField.Value.ToString() == "2")
        {
            //run the undo cut-lenght
            result = WebTools.GetExpr("FNC_CUTLEN_RESET(" + Request.QueryString["ISSUE_ID"] + ")", "DUAL", "");

            if (result == "1")
            {
                Master.ShowMessage("Done!");
            }
            else if (result == "2")
            {
                Master.ShowWarn("Remains used for other jobcards!");
            }
            else
            {
                Master.ShowWarn("Error while deleting cutting plan!");
            }
        }

        //completed

        update_buttons();
    }