protected void btnUpload_Click(object sender, EventArgs e)
        {
            if (ddlpin.SelectedItem.ToString() == "-- Select Zip Code --")
            {
                msgbox("Please Select Zip Code");
                return;
            }
            if (ddlstreet.SelectedItem.ToString() == "-- Select Street --")
            {
                msgbox("Please Select Street");
                return;
            }
            if (ddllocation.SelectedItem.ToString() == "-- Select Location --")
            {
                msgbox("Please Select Location");
                return;
            }

            string pincodecode  = "";
            string areacode     = "";
            string streetcode   = "";
            string locationcode = "";
            string buildingcode = "";

            string pincode  = "";
            string area     = "";
            string street   = "";
            string location = "";
            string building = "";

            pincodecode  = ddlpin.SelectedValue.ToString();
            areacode     = ddlarea.SelectedValue.ToString();
            streetcode   = ddlstreet.SelectedValue.ToString();
            locationcode = ddllocation.SelectedValue.ToString();
            buildingcode = ddlbuilding.SelectedValue.ToString();


            pincode  = ddlpin.SelectedItem.ToString();
            area     = ddlarea.SelectedItem.ToString();
            street   = ddlstreet.SelectedItem.ToString();
            location = ddllocation.SelectedItem.ToString();
            building = ddlbuilding.SelectedItem.ToString();

            //clearing
            lblStatusHeading.Text = "";
            lblStatus.Text        = "";

            DataTable temp = new DataTable();

            temp.Dispose();
            string file_name = "";


            if (!fupData.HasFile)
            {
                lblStatusHeading.Text = "File Upload : Failed";
                lblStatus.Text        = "Select non-empty tab deliminated file first and try again";
                return;
            }


            //check - file extension
            if (fupData.PostedFile.ContentType != "text/plain")
            {
                lblStatusHeading.Text = "File Upload : Failed";
                lblStatus.Text        = "Only tab deliminated text(.txt) files are allowed";
                return;
            }
            else
            {
                if (!SecurityValidation.SizeUploadValidation(fupData))
                {
                    lblStatusHeading.Text = "File Upload : Failed";
                    lblStatus.Text        = "Please upload file less than 5MB";
                    return;
                }
            }

            //check - file length
            if (fupData.PostedFile.ContentLength == 0)
            {
                lblStatusHeading.Text = "File Upload : Failed";
                lblStatus.Text        = "File does not have contents";
                return;
            }

            //check - directory and save file in diectory
            //string directoryPath = string.Format(@"D:/DataUpload/HathwayAutoRenewal/{0}", username.Trim());
            //string filePath = directoryPath + "/" + fupData.PostedFile.FileName;
            //try
            //{
            //    if (!Directory.Exists(directoryPath))
            //    {
            //        Directory.CreateDirectory(directoryPath);
            //    }
            //    fupData.SaveAs(filePath);
            //}
            string directoryPath = string.Format(@"D:/DataUpload/Hathway/{0}", username.Trim());
            //string directoryPath = string.Format(@"E:/DataUpload/Hathway/{0}", username.Trim());
            string filePath = directoryPath + "/" + fupData.PostedFile.FileName;

            try
            {
                if (!Directory.Exists(directoryPath))
                {
                    Directory.CreateDirectory(directoryPath);
                }
                fupData.SaveAs(filePath);
            }
            catch (Exception ex)
            {
                lblStatusHeading.Text = "File Upload : Failed";
                lblStatus.Text        = ex.Message.ToString();

                return;
            }

            Cls_Presentation_Helper helper = new Cls_Presentation_Helper();
            DateTime date          = DateTime.Now;
            string   cur_timestamp = DateTime.Now.ToString("dd-MMM-yyyy hh:mm:ss");
            string   cur_time      = DateTime.Now.ToString("dd-MMM-yyyy_hh:mm:ss");

            file_name = fupData.PostedFile.FileName;

            Random random = new Random();

            Unique_id = username + "_" + cur_time + "_" + random.Next(1000, 9999);
            ViewState["upload_id"] = Unique_id;


            string table_columns = "( VAR_CUST_STB, VAR_CUST_VC,VAR_CUST_APPLICANTTITLE,VAR_CUST_APPLICANTFIRSTNM,VAR_CUST_APPLICANTMEDDILNM,VAR_CUST_APPLICANTLASTNM,";

            table_columns += " VAR_CUST_MOBILENO,VAR_CUST_LANDLINE,VAR_CUST_EMAIL,VAR_CUST_FLATNO,VAR_CUST_ADDRESS1,VAR_CUST_CITY,var_cust_planname,VAR_CUST_ZIPCODE constant \"" + pincodecode + "\",VAR_CUST_AREA constant \"" + area + "\",";
            table_columns += " VAR_CUST_AREACODE constant \"" + areacode + "\",VAR_CUST_STREET constant \"" + street + "\",VAR_CUST_LOCATION constant \"" + location + "\",VAR_CUST_BUILDING constant \"" + building + "\",VAR_CUST_UNIQUNO constant \"" + Unique_id + "\",VAR_CUST_LCOCODE constant \"" + username + "\",var_cust_state constant \"" + ViewState["State"] + "\")";

            string uploadResult = helper.cDataUpload("D:\\DataUpload\\Hathway\\" + username + "\\" + fupData.PostedFile.FileName,
                                                     "D:\\DataUpload\\Hathway\\" + username + "\\HathwayBulkEcafCTL.txt",
                                                     "D:\\DataUpload\\Hathway\\" + username + "\\HathwayBulkEcafLOG.log",
                                                     table_columns, "UPASSDB", "UPASS", "cba", "aoup_crf_cust_bulk_Raw", ""
                                                     );

            if (uploadResult == "0")
            {
                callprocedureTemp();

                Response.Redirect("../Reports/frmMeddleBulkTransaction.aspx?uniqueid=" + Unique_id.Trim());
            }
            else
            {
                if (uploadResult == "")
                {
                    lblStatus.Text = "Error While Uploading...";
                }
                else
                {
                    lblStatus.Text = uploadResult.ToString();
                }
            }
        }
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            lblStatusHeading.Text = "";
            lblStatus.Text        = "";

            DataTable temp = new DataTable();

            temp.Dispose();
            string file_name = "";


            if (!fupData.HasFile)
            {
                lblStatusHeading.Text = "File Upload : Failed";
                lblStatus.Text        = "Select non-empty tab deliminated file first and try again";
                return;
            }
            else
            {
                if (!SecurityValidation.SizeUploadValidation(fupData))
                {
                    lblStatusHeading.Text = "File Upload : Failed";
                    lblStatus.Text        = "Please upload file less than 5MB";
                    return;
                }
            }

            // check - file extension
            if (fupData.PostedFile.ContentType != "text/plain")
            {
                lblStatusHeading.Text = "File Upload : Failed";
                lblStatus.Text        = "Only tab deliminated text(.txt) files are allowed";
                return;
            }

            //check - file length
            if (fupData.PostedFile.ContentLength == 0)
            {
                lblStatusHeading.Text = "File Upload : Failed";
                lblStatus.Text        = "File does not have contents";
                return;
            }

            //check - directory and save file in diectory
            string directoryPath = string.Format(@"D:/DataUpload/HathwayBulk/{0}", username.Trim());
            string filePath      = directoryPath + "/" + fupData.PostedFile.FileName;

            try
            {
                if (!Directory.Exists(directoryPath))
                {
                    Directory.CreateDirectory(directoryPath);
                }
                fupData.SaveAs(filePath);
            }
            catch (Exception ex)
            {
                lblStatusHeading.Text = "File Upload : Failed";
                lblStatus.Text        = ex.Message.ToString();

                return;
            }

            Cls_Presentation_Helper helper = new Cls_Presentation_Helper();
            DateTime date          = DateTime.Now;
            string   cur_timestamp = DateTime.Now.ToString("dd-MMM-yyyy hh:mm:ss");
            string   cur_time      = DateTime.Now.ToString("dd-MMM-yyyy_hh:mm:ss");

            file_name = fupData.PostedFile.FileName;
            Random random = new Random();

            upload_id = username + "_" + cur_time + "_" + random.Next(1000, 9999);
            ViewState["upload_id"] = upload_id;

            string table_columns = "( VAR_ACTDCT_ACCNO, VAR_ACTDCT_VCID, VAR_ACTDCT_REASON, VAR_ACTDCT_LCOCODE,var_actdct_action,VAR_ACTDCT_FILENAME constant \"" + file_name + "\",VAR_ACTDCT_FILEUNIQUEID constant \"" + upload_id + "\")";

            string uploadResult = helper.cDataUpload("D:\\DataUpload\\HathwayBulk\\" + username + "\\" + fupData.PostedFile.FileName,
                                                     "D:\\DataUpload\\HathwayBulk\\" + username + "\\HathwayBulkActDctCTL.txt",
                                                     "D:\\DataUpload\\HathwayBulk\\" + username + "\\HathwayBulkActDctLOG.log",
                                                     table_columns, "Upassdb", "UPASS", "cba", "aoup_lcopre_Bulk_act_dct_Raw", ""
                                                     );

            if (uploadResult == "0")
            {
                callprocedureTemp();
            }
            else
            {
                if (uploadResult == "")
                {
                    lblStatus.Text = "Error While Uploading...";
                }
                else
                {
                    lblStatus.Text = uploadResult.ToString();
                }
            }
        }
Example #3
0
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            if (rblMode.SelectedValue == "0")
            {
                if (txtAccountNo.Text.Length > 0)
                {
                    string valid = SecurityValidation.chkData("N", txtAccountNo.Text);

                    if (valid == "")
                    {
                        String IPAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                        if (IPAddress == null)
                        {
                            IPAddress = Request.ServerVariables["REMOTE_ADDR"];
                        }
                        string IPAdd = Convert.ToString(IPAddress);
                        Cls_Business_UserAccountMap obj = new Cls_Business_UserAccountMap();

                        string pro_output = obj.UserAccountMap(Session["username"].ToString().Trim(), IPAdd, ddlLco.SelectedValue, txtAccountNo.Text, rblAction.SelectedValue.ToString(), "S");
                        if (pro_output.Split('#')[0] == "9999")
                        {
                            lblStatusHeading.Text = "Successful";
                            lblStatus.Text        = "";
                        }
                        else
                        {
                            lblStatusHeading.Text = pro_output.Split('#')[1].ToString();// "File Upload : Failed";
                        }
                        txtAccountNo.Text       = "";
                        ddlLco.SelectedIndex    = 0;
                        rblAction.SelectedValue = "Y";
                    }
                    else
                    {
                        lblStatusHeading.Text = valid.ToString();
                        return;
                    }
                }
            }
            else
            {
                lblStatusHeading.Text = "";
                lblStatus.Text        = "";

                DataTable temp = new DataTable();

                temp.Dispose();
                string file_name = "";


                if (!fupData.HasFile)
                {
                    lblStatusHeading.Text = "File Upload : Failed";
                    lblStatus.Text        = "Select non-empty tab deliminated file first and try again";
                    return;
                }


                //check - file extension
                if (fupData.PostedFile.ContentType != "text/plain")
                {
                    lblStatusHeading.Text = "File Upload : Failed";
                    lblStatus.Text        = "Only tab deliminated text(.txt) files are allowed";
                    return;
                }
                else
                {
                    if (!SecurityValidation.SizeUploadValidation(fupData))
                    {
                        lblStatusHeading.Text = "File Upload : Failed";
                        lblStatus.Text        = "Please upload file less than 5MB";
                        return;
                    }
                }

                if (fupData.PostedFile.ContentLength == 0)
                {
                    lblStatusHeading.Text = "File Upload : Failed";
                    lblStatus.Text        = "File does not have contents";
                    return;
                }

                //check - directory and save file in diectory
                string directoryPath = string.Format(@"D:/DataUpload/HathwayBulk/{0}", Session["username"].ToString().Trim());
                string filePath      = directoryPath + "/" + fupData.PostedFile.FileName;
                try
                {
                    if (!Directory.Exists(directoryPath))
                    {
                        Directory.CreateDirectory(directoryPath);
                    }
                    fupData.SaveAs(filePath);
                }
                catch (Exception ex)
                {
                    lblStatusHeading.Text = "File Upload : Failed";
                    lblStatus.Text        = ex.Message.ToString();

                    return;
                }

                Cls_Presentation_Helper helper = new Cls_Presentation_Helper();
                DateTime date          = DateTime.Now;
                string   cur_timestamp = DateTime.Now.ToString("dd-MMM-yyyy hh:mm:ss");
                string   cur_time      = DateTime.Now.ToString("dd-MMM-yyyy_hh:mm:ss");
                file_name = fupData.PostedFile.FileName;
                Random random = new Random();
                upload_id = username + "_" + cur_time + "_" + random.Next(1000, 9999);
                ViewState["upload_id"] = upload_id;

                string table_columns = "( var_user_acc_username, var_user_acc_accountno, Var_user_acc_activeflag)";

                string uploadResult = helper.cDataUpload("D:\\DataUpload\\HathwayBulk\\" + Session["username"].ToString().Trim() + "\\" + fupData.PostedFile.FileName,
                                                         "D:\\DataUpload\\HathwayBulk\\" + Session["username"].ToString().Trim() + "\\HathwayUserAccMappingCTL.txt",
                                                         "D:\\DataUpload\\HathwayBulk\\" + Session["username"].ToString().Trim() + "\\HathwayUserAccMappingLOG.log",
                                                         table_columns, "Upassdb", "UPASS", "cba", "AOUP_LCOPRE_USER_ACC_MAP_raw", ""
                                                         );

                if (uploadResult == "0")
                {
                    callprocedureTemp();
                }
                else
                {
                    if (uploadResult == "")
                    {
                        lblStatus.Text    = "Error While Uploading...";
                        lblStatus.Visible = true;
                    }
                    else
                    {
                        lblStatus.Text    = uploadResult.ToString();
                        lblStatus.Visible = true;
                    }
                }
            }
        }
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            //clearing
            lblStatusHeading.Text = "";
            lblStatus.Text        = "";
            // btnBeginTrans.Visible = false;
            pnlErrData.Visible = false;
            if (ViewState["Bulk"].ToString() == "C")
            {
                change.Visible = true;
            }
            else
            {
                Operation.Visible = true;
            }

            // pnlSummary.Visible = false;
            DataTable temp = new DataTable();

            rptErrData.DataSource = temp;
            rptErrData.DataBind();
            temp.Dispose();
            string file_name = "";

            //check - file selected
            if (!fupData.HasFile)
            {
                lblStatusHeading.Text = "File Upload : Failed";
                lblStatus.Text        = "Select non-empty tab deliminated file first and try again";
                return;
            }
            else
            {
                if (!SecurityValidation.SizeUploadValidation(fupData))
                {
                    lblStatusHeading.Text = "File Upload : Failed";
                    lblStatus.Text        = "Please upload file less than 5MB";
                    return;
                }
            }


            //check - file extension
            if (fupData.PostedFile.ContentType != "text/plain")
            {
                lblStatusHeading.Text = "File Upload : Failed";
                lblStatus.Text        = "Only tab deliminated text(.txt) files are allowed";
                return;
            }

            //check - file length
            if (fupData.PostedFile.ContentLength == 0)
            {
                lblStatusHeading.Text = "File Upload : Failed";
                lblStatus.Text        = "File does not have contents";
                return;
            }
            if (Session["username"] != null)
            {
                username = ddlLco.SelectedValue;//Session["username"].ToString().Trim();
            }
            //check - directory and save file in diectory
            string directoryPath = string.Format(@"D:/DataUpload/Hathway/{0}", username.Trim());
            //string directoryPath = string.Format(@"E:/DataUpload/Hathway/{0}", username.Trim());
            string filePath = directoryPath + "/" + fupData.PostedFile.FileName;

            try
            {
                if (!Directory.Exists(directoryPath))
                {
                    Directory.CreateDirectory(directoryPath);
                }
                fupData.SaveAs(filePath);
            }
            catch (Exception ex)
            {
                lblStatusHeading.Text = "File Upload : Failed";
                lblStatus.Text        = ex.Message.ToString();
                // btnBeginTrans.Visible = false;
                return;
            }

            Cls_Presentation_Helper helper = new Cls_Presentation_Helper();
            DateTime date          = DateTime.Now;
            string   cur_timestamp = DateTime.Now.ToString("dd-MMM-yyyy hh:mm:ss");

            string cur_time = DateTime.Now.ToString("dd-MMM-yyyy_hh:mm:ss");

            file_name = fupData.PostedFile.FileName;
            Random random = new Random();

            upload_id = username + "_" + cur_time + "_" + random.Next(1000, 9999);
            ViewState["upload_id"] = upload_id;
            string table_columns = "( var_lcopre_bulk_custid, var_lcopre_bulk_vcid, var_lcopre_bulk_lcocode, var_lcopre_bulk_planname, var_lcopre_bulk_action, var_lcopre_bulk_ecs_flag ,var_lcopre_bulk_insby constant \"" + username + "\", var_lcopre_bulk_useruniqueid constant \"" + upload_id + "\", dat_lcopre_bulk_date constant \"" + cur_timestamp + "\",  var_lcopre_bulk_file constant \"" + file_name + "\",var_two_step_proc_flag constant \"" + "Y" + "\",var_lcopre_bulk_new_planname,var_lcopre_bulk_foc_1,var_lcopre_bulk_foc_2,var_lcopre_bulk_foc_3)";

            string uploadResult = helper.cDataUpload("D:\\DataUpload\\Hathway\\" + username + "\\" + fupData.PostedFile.FileName,
                                                     "D:\\DataUpload\\Hathway\\" + username + "\\HathwayCTL.txt",
                                                     "D:\\DataUpload\\Hathway\\" + username + "\\HathwayLOG.log",
                                                     table_columns, "upassdb", "upass", "cba", "aoup_lcopre_bulk_upload_raw",
                                                     upload_id);


            if (uploadResult == "0")
            {
                Response.Redirect("../Reports/frmMiddlePageBulkTransaction.aspx?uniqueid=" + upload_id);
                // callprocedure();
            }
            else
            {
                if (uploadResult == "")
                {
                    lblStatus.Text = "Error While Uploading...";
                }
                else
                {
                    lblStatus.Text = uploadResult.ToString();
                }
            }
        }
Example #5
0
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            //clearing
            lblStatusHeading.Text = "";
            lblStatus.Text        = "";

            DataTable temp = new DataTable();

            temp.Dispose();
            string file_name = "";


            if (!fupData.HasFile)
            {
                lblStatusHeading.Text = "File Upload : Failed";
                lblStatus.Text        = "Select non-empty tab deliminated file first and try again";
                return;
            }

            //check - file extension
            if (fupData.PostedFile.ContentType != "text/plain")
            {
                lblStatusHeading.Text = "File Upload : Failed";
                lblStatus.Text        = "Only tab deliminated text(.txt) files are allowed";
                return;
            }
            else
            {
                if (!SecurityValidation.SizeUploadValidation(fupData))
                {
                    lblStatusHeading.Text = "File Upload : Failed";
                    lblStatus.Text        = "Please upload file less than 5MB";
                    return;
                }
            }

            //check - file length
            if (fupData.PostedFile.ContentLength == 0)
            {
                lblStatusHeading.Text = "File Upload : Failed";
                lblStatus.Text        = "File does not have contents";
                return;
            }

            //check - directory and save file in diectory
            string directoryPath = string.Format(@"D:/DataUpload/HathwayAutoRenewal/{0}", username.Trim());
            string filePath      = directoryPath + "/" + fupData.PostedFile.FileName;

            try
            {
                if (!Directory.Exists(directoryPath))
                {
                    Directory.CreateDirectory(directoryPath);
                }
                fupData.SaveAs(filePath);
            }
            catch (Exception ex)
            {
                lblStatusHeading.Text = "File Upload : Failed";
                lblStatus.Text        = ex.Message.ToString();

                return;
            }

            Cls_Presentation_Helper helper = new Cls_Presentation_Helper();
            DateTime date          = DateTime.Now;
            string   cur_timestamp = DateTime.Now.ToString("dd-MMM-yyyy hh:mm:ss");
            string   cur_time      = DateTime.Now.ToString("dd-MMM-yyyy_hh:mm:ss");

            file_name = fupData.PostedFile.FileName;



            string table_columns = "( var_lcopre_ecs_accno, var_lcopre_ecs_vcid,var_lcopre_ecs_plan,var_lcopre_ecs_lcocode,var_lcopre_ecs_flag,DAT_ECS_VALIDUPTO)";

            string uploadResult = helper.cDataUpload("D:\\DataUpload\\HathwayAutoRenewal\\" + username + "\\" + fupData.PostedFile.FileName,
                                                     "D:\\DataUpload\\HathwayAutoRenewal\\" + username + "\\HathwayAutoRenewalCTL.txt",
                                                     "D:\\DataUpload\\HathwayAutoRenewal\\" + username + "\\HathwayAutoRenewalLOG.log",
                                                     table_columns, "upassdb", "upass", "cba", "aoup_lcopre_ecs_raw", ""
                                                     );

            if (uploadResult == "0")
            {
                callprocedureTemp();
            }
            else
            {
                if (uploadResult == "")
                {
                    lblStatus.Text = "Error While Uploading...";
                }
                else
                {
                    lblStatus.Text = uploadResult.ToString();
                }
            }
        }