protected void bindData()
    {
        CryptoGraphy  crypt  = new CryptoGraphy();
        StringBuilder html   = new StringBuilder();
        string        isdata = string.Empty;

        try
        {
            html.Append("<table class='table table-bordered'>");
            html.Append("<thead>");
            html.Append("<tr class='grey'><th>PO No</th><th>PO Date</th><th>PO Gross</th><th>Request Number</th><th>Request Date</th><th>Delivery Chalan</th></tr>");
            html.Append("</thead>");
            html.Append("<tbody>");
            DataTable dt = (DataTable)ActionController.ExecuteAction("", "SUB_CONTRACT_PO_DC _GENRATE.aspx", "getacknowledgement", ref isdata, txt_Username.Text, txtWIID.Text);
            if (dt != null && dt.Rows.Count > 0)
            {
                PK_DC_ID.Text      = Convert.ToString(dt.Rows[0]["PK_DC_ID"]);
                CREATED_BY.Text    = Convert.ToString(dt.Rows[0]["CREATED_BY"]);
                txt_Condition.Text = Convert.ToString(dt.Rows[0]["HEADER_INFO"]);
                pono.Text          = Convert.ToString(dt.Rows[0]["PO_Number"]);
                string encrypt_Str    = crypt.Encryptdata(Convert.ToString(dt.Rows[0]["PO_Number"]));
                string encrypt_Chalan = crypt.Encryptdata(Convert.ToString(dt.Rows[0]["DC_ID"]));
                html.Append("<tr><td><a href='#' onclick='viewData()'><input type='text' id='encrypt_po' value='" + encrypt_Str + "' style='display:none'><input type='text' id='pk_dc_id' value='" + Convert.ToString(dt.Rows[0]["PK_DC_ID"]) + "' style='display:none'>" + Convert.ToString(dt.Rows[0]["PO_Number"]) + "</a></td><td>" + Convert.ToString(dt.Rows[0]["PO_Date"]) + "</td><td style='text-align: right;'>" + Convert.ToString(dt.Rows[0]["PO_GV"]) + "</td><td>" + Convert.ToString(dt.Rows[0]["HEADER_INFO"]) + "</td><td>" + Convert.ToString(dt.Rows[0]["REQUEST_DATE"]) + "</td><td><a href='#' onclick=viewChalan()>Delivery Chalan</a><input type='text' id='encrypt_chalan' value='" + encrypt_Chalan + "' style='display:none'></td></tr>");
            }

            html.Append("</tbody>");
            html.Append("</table>");
            div_Details.InnerHtml = Convert.ToString(html);
        }
        catch (Exception Exc) { Logger.WriteEventLog(false, Exc); }
    }
Beispiel #2
0
        public bool CheckBasicSetting()
        {
            string sid = GetSettingValue("SID");

            if (String.IsNullOrEmpty(sid))
            {
                return(false);
            }

            string password = GetSettingValue("Password");

            if (String.IsNullOrEmpty(password))
            {
                return(false);
            }

            try
            {
                password = CryptoGraphy.DecryptCipherTextToPlainText(GetSettingValue("Password"));
            }
            catch (Exception)
            {
                return(false);
            }

            return(true);
        }
Beispiel #3
0
        void InitOrderMaker()
        {
            string name = _settingsManager.GetSettingValue(AppSettingsKey.OrderMaker);
            string ip   = _settingsManager.GetSettingValue(AppSettingsKey.OrderMakerIP);
            string sid  = _settingsManager.GetSettingValue(AppSettingsKey.SID);
            string pw   = CryptoGraphy.DecryptCipherTextToPlainText(_settingsManager.GetSettingValue(AppSettingsKey.Password));

            _orderMaker = ProviderFactory.Create(name, ip, sid, pw);
        }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string       name     = TextBox1.Text;
        string       age      = TextBox2.Text;
        string       mobile   = TextBox3.Text;
        string       gender   = RadioButtonList1.SelectedItem.Text;
        string       email    = TextBox4.Text;
        string       password = TextBox5.Text;
        CryptoGraphy cg       = new CryptoGraphy();

        password = cg.MD5Hash(password);
        string specialmedical = TextBox6.Text;

        Random rnd = new Random();

        string otp       = rnd.Next(100000, 999999).ToString();
        bool   otpstatus = false;

        string date = DateTime.Now.ToString("MM/dd/yyyy");
        string time = DateTime.Now.ToString("HH:mm:ss");

        DataBaseManager dbm = new DataBaseManager();

        string    checkemail = "select * from RegistrationTbl where Email='" + email + "'";
        DataTable dt         = new DataTable();

        dt = dbm.ExecuteSelect(checkemail);
        if (dt.Rows.Count > 0)
        {
            Response.Write("<script>alert('Email ID is already registered. Please use another Email ID')</script>");
        }
        else
        {
            string query = "insert into RegistrationTbl(Name,Age,Mobile,Gender,Email,Password,SpecialMedicalCondition,OTP,OTPStatus,Date,Time) values('" + name + "','" + age + "','" + mobile + "','" + gender + "','" + email + "','" + password + "','" + specialmedical + "','" + otp + "','" + otpstatus + "','" + date + "','" + time + "')";
            if (dbm.ExecuteIUD(query))
            {
                // send OTP and Redirect to OTP Verification page

                SMSSender sms     = new SMSSender();
                string    message = "Dear " + name + ", Your OTP Verification Code is - " + otp;
                bool      smsst   = sms.SendSMS(mobile, message);

                // Create Session for OTP Verification

                Session["RegEmail"] = email;

                Response.Write("<script>alert('Data Saved. We have sent you OTP Code, Please enter to proceed.'); window.location.href='OTPVerification.aspx';</script>");
            }
            else
            {
                // Query Error
                Response.Write("<script>alert('Something went wrong, please try again leter, some technical issue.')</script>");
            }
        }
    }
    protected void lnkResetPassword_Click(object sender, EventArgs e)
    {
        lblMessage.Text = "";
        CryptoGraphy objEncrypt = new CryptoGraphy();

        lnkResetPassword.Enabled   = false;
        objLogin.intRegistartionID = Convert.ToInt32(ViewState["UserID"]);
        dt = objLoginDB.GetDataTable(objLogin, DA_Login.Login_1.UserDetails);
        if (dt.Rows.Count > 0)
        {
            string oldPass = objEncrypt.Decrypt(Convert.ToString(dt.Rows[0]["vchrPassword"]));
            if (txtOldPassword.Text.Trim() == Convert.ToString(objEncrypt.Decrypt(Convert.ToString(dt.Rows[0]["vchrPassword"]))))
            {
                objregistration.RegistrationId = Convert.ToInt32(ViewState["UserID"]);
                objregistration.Password       = objEncrypt.Encrypt(txtNewPassword.Text.Trim());
                objLoginDB.AddEditDel_RegistrationDetails(objregistration, DA_Login.Login_1.SelectForUser);

                objLoginDB.AddAndGetLoginDetails(objLogin, DA_SKORKEL.DA_Login.Login_1.ChangePassword);

                //   lblMessage.Text = "Password updated successfully.";
                //  lblMessage.CssClass = "GreenErrormsg";
                System.Web.UI.ScriptManager.RegisterStartupScript(this, this.GetType(), "Yelert", "showSuccessPopupRstPwd('Success','Password updated successfully.')", true);
                lnkResetPassword.Enabled = true;
                //remember me cookie removed .
                //Response.Cookies["myScrlCookie"].Expires = DateTime.Now.AddDays(-1);
                //Response.Cookies["myScrlCookie"].Values.Add("Password", objregistration.Password.ToString());

                if (Request.Cookies["myScrlCookie"] != null)
                {
                    Response.Cookies["myScrlCookie"].Values.Add("UserID", Request.Cookies.Get("myScrlCookie").Values["UserID"].ToString());
                    Response.Cookies["myScrlCookie"].Values.Add("UserName", Request.Cookies.Get("myScrlCookie").Values["UserName"].ToString());
                    Response.Cookies["myScrlCookie"].Values.Add("Password", hdnEncpass.Value.Trim());
                    Session["hdnEncpass"] = hdnEncpass.Value.Trim();
                    Response.Cookies["myScrlCookie"].HttpOnly = false;
                }
                //myScrlCookie.Values.Add("Password", objregistration.Password.ToString());
            }
            else
            {
                lblMessage.Text          = "Old password is incorrect.";
                lblMessage.CssClass      = "RedErrormsg";
                lnkResetPassword.Enabled = true;
                return;
            }
        }
        else
        {
            lblMessage.Text          = "Old password is incorrect.";
            lblMessage.CssClass      = "RedErrormsg";
            lnkResetPassword.Enabled = true;
            return;
        }
    }
Beispiel #6
0
        void InitOrderMaker()
        {
            string name = _settingsManager.GetSettingValue(AppSettingsKey.OrderMaker);
            string ip   = _settingsManager.GetSettingValue(AppSettingsKey.OrderMakerIP);
            string sid  = _settingsManager.GetSettingValue(AppSettingsKey.SID);
            string pw   = CryptoGraphy.DecryptCipherTextToPlainText(_settingsManager.GetSettingValue(AppSettingsKey.Password));

            _orderMaker = ProviderFactory.Create(name, ip, sid, pw);

            _orderMaker.Ready += OnOrderMakerReady;
            _orderMaker.ConnectionStatusChanged += OrderMaker_ConnectionStatusChanged;
            _orderMaker.ExceptionHappend        += OnOrderMakerExceptionHappend;
            _orderMaker.ActionExecuted          += OrderMaker_ActionExecuted;
        }
Beispiel #7
0
    protected void btnchange_Click(object sender, EventArgs e)
    {
        CryptoGraphy cg        = new CryptoGraphy();
        string       oldpass   = OldPass.Text;
        string       newpass   = NewPass.Text;
        string       renewpass = ReNewPass.Text;

        oldpass   = cg.MD5Hash(oldpass);
        newpass   = cg.MD5Hash(newpass);
        renewpass = cg.MD5Hash(renewpass);

        string          email = Session["PatientEmail"].ToString();
        DataBaseManager dbm   = new DataBaseManager();
        string          sql1  = "select * from RegistrationTbl where Email='" + email + "'";
        DataTable       dt    = new DataTable();

        dt = dbm.ExecuteSelect(sql1);
        if (dt.Rows.Count > 0)
        {
            if (dt.Rows[0]["Password"].ToString() == oldpass)
            {
                if (newpass == renewpass)
                {
                    string sql2 = "update RegistrationTbl set Password='******' where Email='" + email + "'";
                    if (dbm.ExecuteIUD(sql2))
                    {
                        Response.Write("<script>alert('Password Changed Successfully.')</script>");
                    }
                    else
                    {
                        Response.Write("<script>alert('Something went wrong.')</script>");
                    }
                }
                else
                {
                    Response.Write("<script>alert('New Password Not Matched.')</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('Old Password Not Matched.')</script>");
            }
        }
        else
        {
            Response.Redirect("../Login.aspx");
        }
    }
Beispiel #8
0
        static void Main(string[] args)
        {
            //CryptoGraphy cryptoGraphy = new CryptoGraphy();
            Console.WriteLine("Enter Text...");
            string text = Convert.ToString(Console.ReadLine());

            Console.WriteLine("Text after Encrytion");
            string encryptedText = string.Empty;

            encryptedText = CryptoGraphy.Encrypt(text);
            Console.WriteLine(encryptedText);
            string decryptedText = CryptoGraphy.Decrypt(encryptedText);

            Console.WriteLine("Text After Decryption..");
            Console.WriteLine(decryptedText);
            Console.Read();
        }
Beispiel #9
0
        protected void SetupSecureSettingSource()
        {
            Configuration = Isolate.Fake.Instance <Configuration>();
            Factory       = new TestConfigurationFactory(Configuration);

            KeyManager = Isolate.Fake.Instance <SecretKeyManager>();
            Key        = "key";
            Isolate.WhenCalled((() => KeyManager.GetKey())).WillReturn(Key);

            CryptoGraphy = Isolate.Fake.Instance <CryptoGraphy>();
            Isolate.WhenCalled(() => CryptoGraphy.SetKey(Key)).IgnoreCall();
            Name      = "secret";
            Encrypted = "[Secure]=";
            Isolate.WhenCalled((() => CryptoGraphy.Encrypt(Name))).WillReturn(Encrypted);
            Isolate.WhenCalled((() => CryptoGraphy.Decrypt(Encrypted))).WillReturn(Name);

            SecureSettingSource = new ConfigurationSettingSource(Factory);
        }
Beispiel #10
0
        public API_TestForm()
        {
            _settingsManager = Factories.CreateSettingsManager();
            _logger          = LoggerFactory.Create(_settingsManager.LogFilePath);


            string name = _settingsManager.GetSettingValue(AppSettingsKey.OrderMaker);
            string ip   = _settingsManager.GetSettingValue(AppSettingsKey.OrderMakerIP);
            string sid  = _settingsManager.GetSettingValue(AppSettingsKey.SID);
            string pw   = CryptoGraphy.DecryptCipherTextToPlainText(_settingsManager.GetSettingValue(AppSettingsKey.Password));

            _orderMaker                 = ProviderFactory.Create(name, ip, sid, pw);
            _orderMaker.Ready          += this.OnOrderMakerReady;
            _orderMaker.ActionExecuted += this.OnActionExcuted;
            if (_orderMaker.Name == ProviderName.HUA_NAN)
            {
                _orderMaker.AccountPositionUpdated += OrderMaker_AccountPositionUpdated;
            }

            InitializeComponent();
        }
Beispiel #11
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        DataBaseManager dbm      = new DataBaseManager();
        string          email    = TextBox1.Text;
        string          password = TextBox2.Text;
        string          sql      = "select * from RegistrationTbl where Email='" + email + "'";
        DataTable       dt       = new DataTable();

        dt = dbm.ExecuteSelect(sql);
        if (dt.Rows.Count > 0)
        {
            bool otpst = Convert.ToBoolean(dt.Rows[0]["OTPStatus"]);
            if (otpst)
            {
                CryptoGraphy cg = new CryptoGraphy();
                password = cg.MD5Hash(password);
                string    sql1 = "select * from RegistrationTbl where Email='" + email + "' and Password='******'";
                DataTable dt1  = new DataTable();
                dt1 = dbm.ExecuteSelect(sql1);
                if (dt1.Rows.Count > 0)
                {
                    Session["PatientEmail"] = email;
                    Response.Redirect("Patient/Dashboard.aspx");
                }
                else
                {
                    Response.Write("<script>alert('Password Invalid.')</script>");
                }
            }
            else
            {
                Response.Write("<script>alert('OTP Not Verified, You can not Login. Contact to Admin.')</script>");
            }
        }
        else
        {
            Response.Write("<script>alert('Email Invalid.')</script>");
        }
    }
    protected void lnkResetPassword_Click(object sender, EventArgs e)
    {
        CryptoGraphy objEncrypt = new CryptoGraphy();

        lnkResetPassword.Enabled   = false;
        objLogin.intRegistartionID = Convert.ToInt32(ViewState["UserID"]);
        dt = objLoginDB.GetDataTable(objLogin, DA_Login.Login_1.UserDetails);
        if (dt.Rows.Count > 0)
        {
            string oldPass = objEncrypt.Decrypt(Convert.ToString(dt.Rows[0]["vchrPassword"]));
            if (txtOldPassword.Text.Trim() == Convert.ToString(objEncrypt.Decrypt(Convert.ToString(dt.Rows[0]["vchrPassword"]))))
            {
                objregistration.RegistrationId = Convert.ToInt32(ViewState["UserID"]);
                objregistration.Password       = objEncrypt.Encrypt(txtNewPassword.Text.Trim());
                objLoginDB.AddEditDel_RegistrationDetails(objregistration, DA_Login.Login_1.SelectForUser);

                objLoginDB.AddAndGetLoginDetails(objLogin, DA_SKORKEL.DA_Login.Login_1.ChangePassword);

                lblMessage.Text          = "Password updated successfully.";
                lblMessage.CssClass      = "GreenErrormsg";
                lnkResetPassword.Enabled = true;
            }
            else
            {
                lblMessage.Text          = "Old password is incorrect.";
                lblMessage.CssClass      = "RedErrormsg";
                lnkResetPassword.Enabled = true;
                return;
            }
        }
        else
        {
            lblMessage.Text          = "Old password is incorrect.";
            lblMessage.CssClass      = "RedErrormsg";
            lnkResetPassword.Enabled = true;
            return;
        }
    }
Beispiel #13
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        DataBaseManager dbm      = new DataBaseManager();
        string          email    = TextBox1.Text;
        string          password = TextBox2.Text;

        CryptoGraphy cg = new CryptoGraphy();

        password = cg.MD5Hash(password);
        string    sql1 = "select * from Admin where Email='" + email + "' and Password='******'";
        DataTable dt1  = new DataTable();

        dt1 = dbm.ExecuteSelect(sql1);
        if (dt1.Rows.Count > 0)
        {
            Session["AdminEmail"] = email;
            Response.Redirect("Admin/Dashboard.aspx");
        }
        else
        {
            Response.Write("<script>alert('Email ID or Password id Incorrect.')</script>");
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string isSaved    = string.Empty;
        string isInserted = string.Empty;
        string ref_data   = string.Empty;

        try
        {
            ActionController.DisablePageCaching(this);
            if (ActionController.IsSessionExpired(this))
            {
                ActionController.RedirctToLogin(this);
            }
            else
            {
                txt_Audit.Text = "LOCAL CONVEYANCE APPROVAL";

                if (ddlAction.SelectedValue == "Approve")
                {
                    // if (doa.Text == "")
                    // {
                    string       msg          = "";
                    string       emailid      = string.Empty;
                    CryptoGraphy crypt        = new CryptoGraphy();
                    string       process_name = crypt.Encryptdata("LOCAL CONVEYANCE");
                    string       req_no       = crypt.Encryptdata(spn_req_no.InnerHtml);
                    DataTable    DTAP         = new DataTable();
                    //if (ddl_Payment_Mode.SelectedItem.Text.ToUpper() == "CASH")
                    //{
                    //    DTAP = (DataTable)ActionController.ExecuteAction("", "Local_Conveyance_Approval.aspx", "getaccapprover", ref ref_data, "LOCAL CONVEYANCE DOC VERIFIER", ddlAdv_Location.SelectedValue, ddl_Payment_Mode.SelectedValue);
                    //}
                    //else
                    //{
                    //    DTAP = (DataTable)ActionController.ExecuteAction("", "Local_Conveyance_Approval.aspx", "getaccapprover", ref ref_data, "LOCAL CONVEYANCE DOC VERIFIER",0, ddl_Payment_Mode.SelectedValue);
                    //}
                    if (ddl_Payment_Mode.SelectedItem.Text.ToUpper() == "CASH")
                    {
                        DTAP = (DataTable)ActionController.ExecuteAction("", "Local_Conveyance_Approval.aspx", "getaccapprover", ref ref_data, "LOCAL CONVEYANCE ACCOUNT PAYMENT APPROVAL", ddlAdv_Location.SelectedValue, ddl_Payment_Mode.SelectedValue);
                    }
                    else
                    {
                        DTAP = (DataTable)ActionController.ExecuteAction("", "Local_Conveyance_Approval.aspx", "getaccapprover", ref ref_data, "LOCAL CONVEYANCE ACCOUNT PAYMENT APPROVAL", 0, ddl_Payment_Mode.SelectedValue);
                    }
                    if (DTAP != null)
                    {
                        if (DTAP.Rows.Count > 0)
                        {
                            txt_Condition.Text = "3";
                            isSaved            = (string)ActionController.ExecuteAction("", "Local_Conveyance_Approval.aspx", "update", ref ref_data, Convert.ToInt32(txt_Condition.Text), txtProcessID.Text, txtInstanceID.Text, txt_Username.Text, txt_Remark.Value, ddlAction.SelectedItem.Text, txt_Audit.Text);
                            if (isSaved == null || ref_data.Length > 0 || isSaved == "false")
                            {
                                string[] errmsg = ref_data.Split(':');
                                Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('" + errmsg[0].ToString() + "');}</script>");
                            }
                            else
                            {
                                string[] Dval = new string[DTAP.Rows.Count];
                                Dval[0] = "";
                                if (DTAP.Rows.Count > 0)
                                {
                                    for (int i = 0; i < DTAP.Rows.Count; i++)
                                    {
                                        Dval[i] = Convert.ToString(DTAP.Rows[i]["USER_ADID"]);
                                        if (txtApproverEmail.Text == "")
                                        {
                                            txtApproverEmail.Text = Convert.ToString(DTAP.Rows[i]["EMAIL_ID"]);
                                        }
                                        else
                                        {
                                            txtApproverEmail.Text = txtApproverEmail.Text + ',' + Convert.ToString(DTAP.Rows[i]["EMAIL_ID"]);
                                        }
                                    }
                                }
                                bool isCreate = (bool)WFE.Action.ReleaseStep(txtProcessID.Text, txtInstanceID.Text, "130", "LOCAL CONVEYANCE APPROVAL", "SUBMIT", txt_Username.Text, txt_Username.Text.Trim(), "", "", "", "", "", "", "", "", "", "", Dval, txt_Request.Text, txtWIID.Text, ref isInserted);
                                if (isCreate)
                                {
                                    try
                                    {
                                        if ((Init_Email.Text != "") && (txtEmailID.Text != ""))
                                        {
                                            if (ddl_Payment_Mode.SelectedItem.Text.ToUpper() == "CASH")
                                            {
                                                msg     = "<pre><font size='3'>Dear Sir/Madam,</font></pre><p/> <pre><font size='3'>Local Conveyance Request has been sent to Accounts for payment approval..</font></pre><p/> <pre><font size='3'>Request No: " + spn_req_no.InnerHtml + "</font></pre> <pre><font size='3'>Created By: " + span_ename.InnerHtml.Trim() + "</font></pre></p><pre><span style='font-size: medium;'>Please Take Voucher Print By Link Given Below : </span></pre><pre><span style='font-size: medium;'>INTRANET URL:http://espuat/Sudarshan-Portal/Vouchers/Cash_Voucher.aspx?P=" + process_name + "&R=" + req_no + "</span></pre><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><br/><pre>Regards</pre><pre><b>Reporting Admin<b></pre><br/><pre></pre><br/><pre><font size='3'  color='red'><i><b>This is a system generated message. We request you not to reply to this message.</b></i></font></pre>";
                                                emailid = (string)ActionController.ExecuteAction(txt_Username.Text, "Local_Conveyance.aspx", "insetmaildata", ref isInserted, txtProcessID.Text, txtInstanceID.Text, 0, "LOCAL CONVEYANCE APPROVAL", "SUBMIT", Init_Email.Text, txtApproverEmail.Text, msg, "Request No: " + spn_req_no.InnerHtml);
                                            }
                                            else
                                            {
                                                msg     = "<pre><font size='3'>Dear Sir/Madam,</font></pre><p/> <pre><font size='3'>Local Conveyance Request has been sent to Accounts for payment approval..</font></pre><p/> <pre><font size='3'>Request No: " + spn_req_no.InnerHtml + "</font></pre> <pre><font size='3'>Created By: " + span_ename.InnerHtml.Trim() + "</font></pre></p><pre><span style='font-size: medium;'>Please Take Voucher Print By Link Given Below : </span></pre><pre><span style='font-size: medium;'>INTRANET URL:http://espuat/Sudarshan-Portal/Vouchers/Bank_Voucher.aspx?P=" + process_name + "&R=" + req_no + "</span></pre><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><br/><pre>Regards</pre><pre><b>Reporting Admin<b></pre><br/><pre></pre><br/><pre><font size='3'  color='red'><i><b>This is a system generated message. We request you not to reply to this message.</b></i></font></pre>";
                                                emailid = (string)ActionController.ExecuteAction(txt_Username.Text, "Local_Conveyance.aspx", "insetmaildata", ref isInserted, txtProcessID.Text, txtInstanceID.Text, 0, "LOCAL CONVEYANCE APPROVAL", "SUBMIT", Init_Email.Text, txtApproverEmail.Text, msg, "Request No: " + spn_req_no.InnerHtml);
                                            }
                                        }
                                    }
                                    catch (Exception)
                                    {
                                        throw;
                                    }
                                    finally
                                    {
                                        Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Local Conveyance has been sent for account payment approval...!');window.open('../../Portal/SCIL/Home.aspx','frmset_WorkArea');}</script>");
                                    }
                                }
                            }        //
                        }
                        else
                        {
                            Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Account Approver Not Available For " + ddl_Payment_Mode.SelectedItem.Text + " Payment Mode...!');window.open('../../Portal/SCIL/TaskDetails.aspx','frmset_WorkArea');}</script>");
                        }
                    }
                    else
                    {
                        Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Account Approver Not Available For " + ddl_Payment_Mode.SelectedItem.Text + " Payment Mode...!');window.open('../../Portal/SCIL/TaskDetails.aspx','frmset_WorkArea');}</script>");
                    }
                    //}
                    //else
                    //{

                    //      txt_Condition.Text ="1";
                    //      isSaved = (string)ActionController.ExecuteAction("", "Local_Conveyance_Approval.aspx", "update", ref ref_data, Convert.ToInt32(txt_Condition.Text), txtProcessID.Text, txtInstanceID.Text, txt_Username.Text, txt_Remark.Value, ddlAction.SelectedItem.Text, txt_Audit.Text);
                    //      if (isSaved == null || ref_data.Length > 0 || isSaved == "false")
                    //        {
                    //            string[] errmsg = ref_data.Split(':');
                    //            Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('" + errmsg[0].ToString() + "');}</script>");
                    //        }
                    //        else
                    //        {

                    //            string[] Dval = new string[1];
                    //            Dval[0] = doa_user.Text;

                    //            bool isCreate = (bool)WFE.Action.ReleaseStep(txtProcessID.Text, txtInstanceID.Text, "159", "LOCAL CONVEYANCE APPROVAL", "DOA-SUBMIT", txt_Username.Text, txt_Username.Text.Trim(), "", "", "", "", "", "", "", "", "", "", Dval, txt_Request.Text, txtWIID.Text, ref isInserted);
                    //            if (isCreate)
                    //            {
                    //                try
                    //                {
                    //                   // string auditid = (string)ActionController.ExecuteAction(txt_Initiator.Text, "Local_Conveyance.aspx", "insertaudittrail", ref isInserted, txtProcessID.Text, txtInstanceID.Text, "LOCAL CONVEYANCE APPROVAL", "USER", txt_Username.Text, "DOA-SUBMIT", txt_Remark.Value, "0", "0");

                    //                    string msg = "<pre><font size='3'>Dear Sir/Madam,</font></pre><p/> <pre><font size='3'>Local Conveyance Request has been Approved for deviation.</font></pre><p/> <pre><font size='3'>Request No: " + spn_req_no.InnerHtml + "</font></pre> <pre><font size='3'>Created By: " + txt_Initiator.Text.Trim() + "</font></pre></p><pre></b><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><br/><pre>Regards</pre><pre><b>Reporting Admin<b></pre><br/><pre></pre><br/><pre><font size='3'  color='red'><i><b>This is a system generated message. We request you not to reply to this message.</b></i></font></pre>";

                    //                    string emailid = (string)ActionController.ExecuteAction(txt_Username.Text, "Local_Conveyance.aspx", "insetmaildata", ref isInserted, txtProcessID.Text, txtInstanceID.Text, 0, "LOCAL CONVEYANCE APPROVAL", "DOA-SUBMIT", Init_Email.Text, doa_email.Text, msg, "Request No: " + spn_req_no.InnerHtml);
                    //                }
                    //                catch (Exception)
                    //                {
                    //                    throw;
                    //                }
                    //                finally
                    //                {
                    //                    Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Local Conveyance Request has been Approved for deviation...!');window.open('../../Portal/SCIL/Home.aspx','frmset_WorkArea');}</script>");
                    //                }
                    //            }
                    //        }

                    //}
                }
                else if (ddlAction.SelectedValue == "Send-Back")
                {
                    txt_Condition.Text = "3";
                    isSaved            = (string)ActionController.ExecuteAction("", "Local_Conveyance_Approval.aspx", "update", ref ref_data, Convert.ToInt32(txt_Condition.Text), txtProcessID.Text, txtInstanceID.Text, txt_Username.Text, txt_Remark.Value, ddlAction.SelectedItem.Text, txt_Audit.Text);

                    if (isSaved == null || ref_data.Length > 0 || isSaved == "false")
                    {
                        string[] errmsg = ref_data.Split(':');
                        Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('" + errmsg[0].ToString() + "');}</script>");
                    }
                    else
                    {
                        string[] Dval = new string[1];
                        Dval[0] = txt_Initiator.Text;
                        bool isCreate = (bool)WFE.Action.ReleaseStep(txtProcessID.Text, txtInstanceID.Text, "131", "LOCAL CONVEYANCE APPROVAL", "SEND-BACK", txt_Username.Text, txt_Initiator.Text.Trim(), txt_Initiator.Text.Trim(), "", "", "", "", "", "", "", "", "", Dval, spn_req_no.InnerHtml, txtWIID.Text, ref isInserted);
                        if (isCreate)
                        {
                            try
                            {
                                //string auditid = (string)ActionController.ExecuteAction(txt_Initiator.Text, "Local_Conveyance.aspx", "insertaudittrail", ref isInserted, txtProcessID.Text, txtInstanceID.Text, "LOCAL CONVEYANCE APPROVAL", "USER", txt_Username.Text, "SEND-BACK", txt_Remark.Value, "0", "0");

                                string msg = "<pre><font size='3'>Dear Sir/Madam,</font></pre><p/> <pre><font size='3'>Local Conveyance Request has been Sent back to Initiator.</font></pre><p/> <pre><font size='3'>Request No: " + spn_req_no.InnerHtml + "</font></pre> <pre><font size='3'>Created By: " + span_ename.InnerHtml.Trim() + "</font></pre></p><pre></b><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><br/><pre>Regards</pre><pre><b>Reporting Admin<b></pre><br/><pre></pre><br/><pre><font size='3'  color='red'><i><b>This is a system generated message. We request you not to reply to this message.</b></i></font></pre>";

                                string emailid = (string)ActionController.ExecuteAction(txt_Username.Text, "Local_Conveyance.aspx", "insetmaildata", ref isInserted, txtProcessID.Text, txtInstanceID.Text, 0, "LOCAL CONVEYANCE APPROVAL", "SEND-BACK", Init_Email.Text, txtEmailID.Text, msg, "Request No: " + spn_req_no.InnerHtml);
                            }
                            catch (Exception)
                            {
                                throw;
                            }
                            finally
                            {
                                Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Local Conveyance Request has been Sent back Successfully...!');window.open('../../Portal/SCIL/Home.aspx','frmset_WorkArea');}</script>");
                            }
                        }
                    }
                }
                else if (ddlAction.SelectedValue == "Reject")
                {
                    txt_Condition.Text = "2";
                    isSaved            = (string)ActionController.ExecuteAction("", "Local_Conveyance_Approval.aspx", "update", ref ref_data, Convert.ToInt32(txt_Condition.Text), txtProcessID.Text, txtInstanceID.Text, txt_Username.Text, txt_Remark.Value, ddlAction.SelectedItem.Text, txt_Audit.Text);
                    if (isSaved == null || ref_data.Length > 0 || isSaved == "false")
                    {
                        string[] errmsg = ref_data.Split(':');
                        Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('" + errmsg[0].ToString() + "');}</script>");
                    }
                    else
                    {
                        string[] Dval = new string[1];
                        Dval[0] = txt_Username.Text;
                        bool isCreate = (bool)WFE.Action.ReleaseStep(txtProcessID.Text, txtInstanceID.Text, "133", "LOCAL CONVEYANCE APPROVAL", "REJECT", txt_Username.Text, txt_Username.Text.Trim(), "", "", "", "", "", "", "", "", "", "", Dval, spn_req_no.InnerHtml, txtWIID.Text, ref isInserted);
                        if (isCreate)
                        {
                            try
                            {
                                //string auditid = (string)ActionController.ExecuteAction(txt_Initiator.Text, "Local_Conveyance.aspx", "insertaudittrail", ref isInserted, txtProcessID.Text, txtInstanceID.Text, "LOCAL CONVEYANCE APPROVAL", "USER", txt_Username.Text, "REJECT", txt_Remark.Value, "0", "0");

                                string msg = "<pre><font size='3'>Dear Sir/Madam,</font></pre> <pre><font size='3'>Local Conveyance Request has been Rejected.</font></pre> <pre><font size='3'>Request No: " + spn_req_no.InnerHtml + "</font></pre><pre><font size='3'>Request reject due to : " + txt_Remark.Value + "</font></pre> <pre><font size='3'>Created By: " + span_ename.InnerHtml.Trim() + "</font></pre></p><pre></b><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><br/><pre>Regards</pre><pre><b>Reporting Admin<b></pre><br/><pre></pre><br/><pre><font size='3'  color='red'><i><b>This is a system generated message. We request you not to reply to this message.</b></i></font></pre>";

                                string emailid = (string)ActionController.ExecuteAction(txt_Username.Text, "Local_Conveyance.aspx", "insetmaildata", ref isInserted, txtProcessID.Text, txtInstanceID.Text, 0, "LOCAL CONVEYANCE APPROVAL", "REJECT", Init_Email.Text, txtEmailID.Text, msg, "Request No: " + spn_req_no.InnerHtml);
                            }
                            catch (Exception)
                            {
                                throw;
                            }
                            finally
                            {
                                Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Local Conveyance has been Rejected...!');window.open('../../Portal/SCIL/Home.aspx','frmset_WorkArea');}</script>");
                            }
                        }
                    }
                }
            }
        }
        catch (Exception Exc) { FSL.Logging.Logger.WriteEventLog(false, Exc); }
    }
    //private void fillPolicy_Details()
    //{
    //    if (ActionController.IsSessionExpired(Page))
    //        ActionController.RedirctToLogin(Page);
    //    else
    //    {
    //        try
    //        {
    //            string isData = string.Empty;
    //            string isValid = string.Empty;
    //            string DisplayData = string.Empty;

    //            DataTable dtamt = (DataTable)ActionController.ExecuteAction("", "Advance_Request.aspx", "selectdetails", ref isValid, lbl_desgnation.Text, "AdDesignation");
    //            if (dtamt != null && dtamt.Rows.Count > 0)
    //            {
    //                DisplayData = "<table class='table table-bordered' id='policyTable'><thead><tr class='grey'><th>Designation</th><th>City Class</th><th>Amount(Rs)</th><th>Effective Date</th></tr></thead>";

    //                for (int i = 0; i < dtamt.Rows.Count; i++)
    //                {
    //                    DisplayData += "<tr><td>" + lbl_desgnation.Text + "</td><td>" + Convert.ToString(dtamt.Rows[i]["CITY_CLASS"]) + "</td><td>" + Convert.ToString(dtamt.Rows[i]["AMOUNT"]) + "</td><td>" + Convert.ToString(dtamt.Rows[i]["EFFECTIVE_DATE"]) + "</td></tr>";

    //                }
    //                DisplayData += "</table>";
    //                txt_policycnt.Text = dtamt.Rows.Count.ToString();
    //            }
    //            else
    //            {
    //                txt_policycnt.Text = dtamt.Rows.Count.ToString();
    //            }
    //            div_policy.InnerHtml = DisplayData;
    //            DisplayData = "";
    //        }
    //        catch (Exception ex)
    //        {
    //            FSL.Logging.Logger.WriteEventLog(false, ex);
    //        }
    //    }
    //}

    protected void btnRequest_Click(object sender, EventArgs e)
    {
        try
        {
            ActionController.DisablePageCaching(this);
            if (ActionController.IsSessionExpired(this))
            {
                ActionController.RedirctToLogin(this);
            }
            else
            {
                //string ISValid1 = string.Empty;
                //string dtamt = (string)ActionController.ExecuteAction("", "Advance_Request.aspx", "checkduplicate", ref ISValid1, txt_fplace.Value, txt_tplace.Value, txt_fdate.Value, txt_tdate.Value, txt_Username.Text);
                //if (dtamt == "true")
                //{
                //    string message = "alert('You have already Submitted Bill For This Period')";
                //    ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", message, true);
                //}
                //else
                //{

                string confirmValue = txt_confirm.Text;
                if (confirmValue == "Yes" || confirmValue == "")
                {
                    string refData    = string.Empty;
                    string isInserted = string.Empty;
                    string ISValid    = string.Empty;
                    txt_Condition.Text = "1";
                    txt_Action.Text    = "Submit";
                    txt_Audit.Text     = "ADVANCE REQUEST";
                    string isSaved = string.Empty;

                    string vehiclexml_string = txt_xml_data_vehicle.Text;
                    vehiclexml_string         = vehiclexml_string.Replace("&", "&amp;");
                    vehiclexml_string         = vehiclexml_string.Replace(">", "&gt;");
                    vehiclexml_string         = vehiclexml_string.Replace("<", "&lt;");
                    vehiclexml_string         = vehiclexml_string.Replace("||", ">");
                    vehiclexml_string         = vehiclexml_string.Replace("|", "<");
                    vehiclexml_string         = vehiclexml_string.Replace("'", "&apos;");
                    txt_xml_data_vehicle.Text = vehiclexml_string.ToString();

                    string inserXML = txt_Document_Xml.Text;
                    inserXML = inserXML.Replace("&", "&amp;");
                    txt_Document_Xml.Text = inserXML.ToString();

                    string instanceID = (string)WFE.Action.StartCase(isInserted, txtProcessID.Text, txt_Username.Text, txt_Username.Text, txtEmailID.Text, "152");
                    txtInstanceID.Text = instanceID;
                    if (ddlPayMode.SelectedValue == "2")
                    {
                        ddlLocation.SelectedValue = "0";
                    }
                    isSaved = (string)ActionController.ExecuteAction("", "Advance_Request.aspx", "insert", ref refData, Convert.ToInt32(txtProcessID.Text), Convert.ToInt32(txtInstanceID.Text), ddlPayMode.SelectedValue, txt_xml_data_vehicle.Text, txt_Username.Text, txt_remark.Value, txt_Audit.Text, txt_Action.Text, txt_approvar.Text, txt_Document_Xml.Text, ddlLocation.SelectedValue, txt_pkexpenseid.Text);
                    if (isSaved == null || refData.Length > 0 || isSaved == "false")
                    {
                        //Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('" + errmsg[1].ToString() + "');}</script>");
                        string[] errmsg = refData.Split(':');
                        ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", "alert('" + errmsg[1].ToString() + "')", true);
                    }
                    else
                    {
                        string[] Request_Unique = isSaved.Split('=');
                        txt_Request.Text = Request_Unique[0];
                        ////upload file code///////////////////
                        string    isValid1 = string.Empty;
                        string[]  arr      = new string[100];
                        DataTable dt       = (DataTable)ActionController.ExecuteAction("", "Advance_Request.aspx", "getrequest_document", ref isValid1, "ADVANCE", Request_Unique[0]);
                        if (dt.Rows.Count > 0)
                        {
                            string activeDir  = ConfigurationManager.AppSettings["DOCPATH"].ToString().Trim();
                            string path       = string.Empty;
                            string foldername = Request_Unique[0];
                            foldername = foldername.Replace("/", "_");
                            path       = activeDir + "\\" + "ADVANCE\\" + foldername;
                            if (Directory.Exists(path))
                            {
                            }
                            else
                            {
                                Directory.CreateDirectory(path);
                                string[] directories = Directory.GetFiles(activeDir + "\\" + "ADVANCE\\");
                                path = path + "\\";
                                foreach (var directory in directories)
                                {
                                    for (int i = 0; i < dt.Rows.Count; i++)
                                    {
                                        var sections = directory.Split('\\');
                                        var fileName = sections[sections.Length - 1];
                                        if (dt.Rows[i]["filename"].ToString().Trim() == fileName)
                                        {
                                            System.IO.File.Move(activeDir + "\\" + "ADVANCE\\" + fileName, path + fileName);
                                            if (System.IO.File.Exists(activeDir + "\\" + "ADVANCE\\" + fileName))
                                            {
                                                System.IO.File.Delete(activeDir + "\\" + "ADVANCE\\" + fileName);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        ///////////////////////////////////////
                        if (lbl_EmpCode.Text == "4263" || lbl_EmpCode.Text == "4262")
                        {
                            string       msg          = "";
                            string       ref_data     = string.Empty;
                            string       emailid      = string.Empty;
                            CryptoGraphy crypt        = new CryptoGraphy();
                            string       process_name = crypt.Encryptdata("ADVANCE EXPENSE");
                            string       req_no       = crypt.Encryptdata(txt_Request.Text);
                            DataTable    DTAP         = new DataTable();

                            if (ddlPayMode.SelectedItem.Text.ToUpper() == "CASH")
                            {
                                DTAP = (DataTable)ActionController.ExecuteAction("", "Advance_Request_Approval.aspx", "getaccapprover", ref ref_data, "ADVANCE REQUEST ACCOUNT PAYABLE APPROVAL", ddlLocation.Text, ddlPayMode.Text);
                            }
                            else
                            {
                                DTAP = (DataTable)ActionController.ExecuteAction("", "Advance_Request_Approval.aspx", "getaccapprover", ref ref_data, "ADVANCE REQUEST ACCOUNT PAYABLE APPROVAL", 0, ddlPayMode.Text);
                            }
                            //if (DTAP != null)
                            //{
                            if (DTAP.Rows.Count > 0 && DTAP != null)
                            {
                                txt_Condition.Text = "3";
                                string isSaved1 = (string)ActionController.ExecuteAction("", "Advance_Request.aspx", "inserttwi", ref ref_data, txtProcessID.Text, txtInstanceID.Text, txt_Username.Text, txt_Request.Text, "5");
                                if (isSaved1 == null || ref_data.Length > 0 || isSaved1 == "false")
                                {
                                    string[] errmsg = refData.Split(':');
                                    //  Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('" + errmsg[1].ToString() + "');}</script>");
                                    ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", "alert('" + errmsg[1].ToString() + "')", true);
                                }
                                else
                                {
                                    string[] Dval = new string[DTAP.Rows.Count];
                                    Dval[0] = "";
                                    if (DTAP.Rows.Count > 0)
                                    {
                                        for (int i = 0; i < DTAP.Rows.Count; i++)
                                        {
                                            Dval[i] = Convert.ToString(DTAP.Rows[i]["USER_ADID"]);
                                            if (txtApproverEmail.Text == "")
                                            {
                                                txtApproverEmail.Text = Convert.ToString(DTAP.Rows[i]["EMAIL_ID"]);
                                            }
                                            else
                                            {
                                                txtApproverEmail.Text = txtApproverEmail.Text + ',' + Convert.ToString(DTAP.Rows[i]["EMAIL_ID"]);
                                            }
                                        }
                                    }
                                    bool isCreate1 = (bool)WFE.Action.ReleaseStep(txtProcessID.Text, txtInstanceID.Text, "158", "ADVANCE REQUEST APPROVAL", "APPROVE", txt_Username.Text, txt_Username.Text.Trim(), "", "", "", "", "", "", "", "", "", "", Dval, txt_Request.Text, "0", ref isInserted);
                                    if (isCreate1)
                                    {
                                        try
                                        {
                                            if (ddlPayMode.SelectedItem.Text.ToUpper() == "CASH")
                                            {
                                                msg     = "<pre><font size='3'>Dear Sir/Madam,</font></pre><p/> <pre><font size='3'>Advance Request has been sent to Accounts for payment approval.</font></pre><p/> <pre><font size='3'>Request No: " + txt_Request.Text + "</font></pre> <pre><font size='3'>Created By: " + lbl_EmpName.Text + "</font></pre></p><pre><span style='font-size: medium;'>Please Take Voucher Print By Link Given Below : </span></pre><pre><span style='font-size: medium;'>INTERNET URL:<a href='https://" + compname + "/Sudarshan-Portal/Vouchers/Cash_Voucher.aspx?P=" + process_name + "&R=" + req_no + "'>https://" + compname + "/Sudarshan-Portal/Vouchers/Cash_Voucher.aspx?P=" + process_name + "&R=" + req_no + "</a></span></pre><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><pre></pre><br/><pre><font size='3'  color='red'><i><b>Kindly attach all the original supporting documents with the voucher print & submit to the Cashier in case mode of payment requested is cash otherwise, send the documents to the Cashier at GHO Pune.</b></i></font></pre>";
                                                emailid = (string)ActionController.ExecuteAction(txt_Username.Text, "Local_Conveyance.aspx", "insetmaildata", ref isInserted, txtProcessID.Text, txtInstanceID.Text, 0, "LOCAL CONVEYANCE APPROVAL", "SUBMIT", txtEmailID.Text, txtApproverEmail.Text, msg, "Request No: " + txt_Request.Text);
                                            }
                                            else
                                            {
                                                msg     = "<pre><font size='3'>Dear Sir/Madam,</font></pre><p/> <pre><font size='3'>Advance Request has been sent to Accounts for payment approval.</font></pre><p/> <pre><font size='3'>Request No: " + txt_Request.Text + "</font></pre> <pre><font size='3'>Created By: " + lbl_EmpName.Text + "</font></pre></p><pre><span style='font-size: medium;'>Please Take Voucher Print By Link Given Below : </span></pre><pre><span style='font-size: medium;'>INTERNET URL:<a href='https://" + compname + "/Sudarshan-Portal/Vouchers/Bank_Voucher.aspx?P=" + process_name + "&R=" + req_no + "'>https://" + compname + "/Sudarshan-Portal/Vouchers/Bank_Voucher.aspx?P=" + process_name + "&R=" + req_no + "</a></span></pre><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><pre></pre><br/><pre><font size='3'  color='red'><i><b>Kindly attach all the original supporting documents with the voucher print & submit to the Cashier in case mode of payment requested is cash otherwise, send the documents to the Cashier at GHO Pune.</b></i></font></pre>";
                                                emailid = (string)ActionController.ExecuteAction(txt_Username.Text, "Local_Conveyance.aspx", "insetmaildata", ref isInserted, txtProcessID.Text, txtInstanceID.Text, 0, "LOCAL CONVEYANCE APPROVAL", "SUBMIT", txtEmailID.Text, txtApproverEmail.Text, msg, "Request No: " + txt_Request.Text);
                                            }
                                        }
                                        catch (Exception)
                                        {
                                            throw;
                                        }
                                        finally
                                        {
                                            string msg2 = string.Empty;
                                            msg2 = "alert('Advance Request has been sent to account payment approval and Request No. is : " + txt_Request.Text + " ...!');window.open('../../Portal/SCIL/Home.aspx','frmset_WorkArea')";
                                            ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", msg2, true);
                                            //  Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Advance Request has been sent to account payment approval and Request No. is : " + txt_Request.Text + " ...!');window.open('../../portal/SCIL/TaskDetails.aspx','frmset_WorkArea');}</script>");
                                        }
                                    }
                                }    //
                            }
                            else
                            {
                                string msg2 = string.Empty;
                                msg2 = "alert('Account Payment Approver Not Available For " + ddlPayMode.SelectedItem.Text + " Payment Mode...!');window.open('../../Portal/SCIL/Home.aspx','frmset_WorkArea')";
                                ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", msg2, true);
                                //Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Account Approver Not Available For " + ddlPayMode.SelectedItem.Text + " Payment Mode...!');window.open('../../Portal/SCIL/TaskDetails.aspx','frmset_WorkArea');}</script>");
                            }
                            // }
                            //else
                            //{
                            //    string msg2 = string.Empty;
                            //    msg2 = "alert('Account Payment Approver Not Available For " + ddlPayMode.SelectedItem.Text + " Payment Mode...!');window.open('../../Portal/SCIL/Home.aspx','frmset_WorkArea')";
                            //    ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", msg2, true);
                            //  //  Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Account Approver Not Available For " + ddlPayMode.SelectedItem.Text + " Payment Mode...!');window.open('../../Portal/SCIL/TaskDetails.aspx','frmset_WorkArea');}</script>");
                            //}
                        }
                        else
                        {
                            string[] Dval1 = new string[1];
                            Dval1[0] = txt_approvar.Text;
                            if (txt_Approver_Email.Text == "")
                            {
                                txt_Approver_Email.Text = txtEmailID.Text;
                            }
                            bool isCreate = (bool)WFE.Action.ReleaseStep(txtProcessID.Text, txtInstanceID.Text, "157", "ADVANCE REQUEST", "SUBMIT", txt_Username.Text, txt_Username.Text.Trim(), "", "", "", "", "", "", "", "", "", "", Dval1, txt_Request.Text, "0", ref isInserted);

                            if (isCreate)
                            {
                                try
                                {
                                    string emailid = string.Empty;
                                    string msg     = "<pre><font size='3'>Dear Sir/Madam,</font></pre><p/> <pre><font size='3'>Advance Request has been sent for your approval.</font></pre><p/>  <pre><font size='3'>Request No: " + txt_Request.Text + "</font></pre><pre><font size='3'>Created By: " + lbl_EmpName.Text.Trim() + "</font></pre></p><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><pre></pre><br/><pre><font size='3'  color='red'><i><b>This is a system generated message. We request you not to reply to this message.</b></i></font></pre>";
                                    emailid = (string)ActionController.ExecuteAction(txt_Username.Text, "Advance_Request.aspx", "insetmaildata", ref isInserted, txtProcessID.Text, txtInstanceID.Text, 0, "ADVANCE REQUEST", "SUBMIT", txt_Approver_Email.Text, txtEmailID.Text, msg, "Request No: " + txt_Request.Text);
                                }
                                catch (Exception ex)
                                {
                                    // throw;
                                    FSL.Logging.Logger.WriteEventLog(false, ex);
                                }
                                finally
                                {
                                    if (txt_deviate.Text == "1")
                                    {
                                        string msg2 = string.Empty;
                                        msg2 = "alert('Advance Request has been sent for approval(under deviation) and Request No. is : " + txt_Request.Text + " ...!');window.open('../../Portal/SCIL/Home.aspx','frmset_WorkArea')";
                                        ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", msg2, true);
                                        // Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Advance Request has been sent for your approval(under deviation) and Request No. is : " + txt_Request.Text + " ...!');window.open('../../portal/SCIL/Home.aspx','frmset_WorkArea');}</script>");
                                    }
                                    else
                                    {
                                        string msg2 = string.Empty;
                                        msg2 = "alert('Advance Request has been sent for approval and Request No. is : " + txt_Request.Text + " ...!');window.open('../../Portal/SCIL/Home.aspx','frmset_WorkArea')";
                                        ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", msg2, true);
                                        // Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Advance Request has been sent for your approval and Request No. is : " + txt_Request.Text + " ...!');window.open('../../portal/SCIL/Home.aspx','frmset_WorkArea');}</script>");
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                }

                divIns.Style.Add("display", "none");
            }
        }
        catch (Exception ex)
        {
            FSL.Logging.Logger.WriteEventLog(false, ex);
        }
    }
Beispiel #16
0
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        try
        {
            ActionController.DisablePageCaching(this);
            if (ActionController.IsSessionExpired(this))
            {
                ActionController.RedirctToLogin(this);
            }
            else
            {
                string isInserted = string.Empty;
                string ref_data   = string.Empty;
                txt_Audit.Text = "FOREIGN ADVANCE REQUEST DEVIATION APPROVAL";
                if (ddlAction.SelectedItem.Text == "Approve")
                {
                    DataTable    DTAP         = new DataTable();
                    string       msg          = "";
                    string       emailid      = string.Empty;
                    CryptoGraphy crypt        = new CryptoGraphy();
                    string       req_no       = crypt.Encryptdata(txt_Request.Text);
                    string       process_name = crypt.Encryptdata("ADVANCE EXPENSE");
                    // txt_Deviate.Text = "1";


                    DTAP = (DataTable)ActionController.ExecuteAction("", "Foreign_Advance_Request_Approval.aspx", "getaccapprover", ref ref_data, "ADVANCE REQUEST FOREIGN ACCOUNT PAYABLE APPROVAL", 0, 2);

                    if (DTAP != null)
                    {
                        if (DTAP.Rows.Count > 0)
                        {
                            txt_Condition.Text = "3";
                            string isSaved = (string)ActionController.ExecuteAction("", "Foreign_Advance_Request_Approval.aspx", "update", ref ref_data, Convert.ToInt32(txt_Condition.Text), txtProcessID.Text, txtInstanceID.Text, txt_Audit.Text, txt_Username.Text, spn_Remark.InnerHtml, ddlAction.SelectedItem.Text);
                            if (isSaved == null || ref_data.Length > 0 || isSaved == "false")
                            {
                                string[] errmsg = ref_data.Split(':');
                                Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('" + errmsg[0].ToString() + "');}</script>");
                            }
                            else
                            {
                                string[] Dval = new string[DTAP.Rows.Count];
                                Dval[0] = "";
                                if (DTAP.Rows.Count > 0)
                                {
                                    for (int i = 0; i < DTAP.Rows.Count; i++)
                                    {
                                        Dval[i] = Convert.ToString(DTAP.Rows[i]["USER_ADID"]);
                                        if (txtApproverEmail.Text == "")
                                        {
                                            txtApproverEmail.Text = Convert.ToString(DTAP.Rows[i]["EMAIL_ID"]);
                                        }
                                        else
                                        {
                                            txtApproverEmail.Text = txtApproverEmail.Text + ',' + Convert.ToString(DTAP.Rows[i]["EMAIL_ID"]);
                                        }
                                    }
                                    string ref_data1  = string.Empty;
                                    string release_id = (string)ActionController.ExecuteAction("", "Foreign_Advance_Request.aspx", "getreleaseid", ref ref_data1, txtProcessID.Text, step_name.Text, "APPROVE");
                                    if (release_id != "")
                                    {
                                        bool isCreate = (bool)WFE.Action.ReleaseStep(txtProcessID.Text, txtInstanceID.Text, release_id, step_name.Text, "APPROVE", txt_Username.Text, txt_Username.Text.Trim(), "", "", "", "", "", "", "", "", "", "", Dval, txt_Request.Text, txtWIID.Text, ref isInserted);

                                        if (isCreate)
                                        {
                                            try
                                            {
                                                //msg = "<pre><font size='3'>Dear Sir/Madam,</font></pre><p/> <pre><font size='3'>Foreign Advance Request has been sent to Accounts for payment approval.</font></pre><p/> <pre><font size='3'>Request No: " + spn_req_no.Text + "</font></pre> <pre><font size='3'>Created By: " + lbl_EmpName.Text.Trim() + "</font></pre></p><pre><span style='font-size: medium;'>Please Take Voucher Print By Link Given Below : </span></pre><pre><span style='font-size: medium;'>INTRANET URL:<a href='http://" + compname + "/Sudarshan-Portal/Vouchers/Foreign_Advance.aspx?P=ADVANCE REQUEST FOREIGN&R=" + spn_req_no.Text + "'>http://" + compname + "/Sudarshan-Portal/Vouchers/Foreign_Advance.aspx?P=ADVANCE REQUEST FOREIGN&R=" + spn_req_no.Text + "</a></span></pre><pre></b><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><pre></pre><br/><pre><font size='3'  color='red'><i><b>This is a system generated message. We request you not to reply to this message.</b></i></font></pre>";
                                                msg     = "<pre><font size='3'>Dear Sir/Madam,</font></pre><p/> <pre><font size='3'>Foreign Advance Request has been sent to Accounts for payment approval.</font></pre><p/> <pre><font size='3'>Request No: " + spn_req_no.Text + "</font></pre> <pre><font size='3'>Created By: " + lbl_EmpName.Text.Trim() + "</font></pre></p><pre><span style='font-size: medium;'>Please Take Voucher Print By Link Given Below : </span></pre><pre><span style='font-size: medium;'>INTRANET URL:<a href='http://" + compname + "/Sudarshan-Portal/Vouchers/Foreign_Advance.aspx?P=ADVANCE REQUEST FOREIGN&R=" + spn_req_no.Text + "'>http://" + compname + "/Sudarshan-Portal/Vouchers/Foreign_Advance.aspx?P=ADVANCE REQUEST FOREIGN&R=" + spn_req_no.Text + "</a></span></pre><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><pre></pre><br/><pre><font size='3'  color='red'><i><b>Kindly attach all the original supporting documents with the voucher print & submit to the Cashier in case mode of payment requested is cash otherwise, send the documents to the Cashier at GHO Pune.</b></i></font></pre>";
                                                emailid = (string)ActionController.ExecuteAction(txt_Username.Text, "Foreign_Advance_Request.aspx", "insetmaildata", ref isInserted, txtProcessID.Text, txtInstanceID.Text, 0, "FOREIGN ADVANCE REQUEST DEVIATION APPROVAL", "APPROVE", Init_Email.Text, txtApproverEmail.Text, msg, "Request No: " + spn_req_no.Text);
                                            }
                                            catch (Exception)
                                            {
                                                throw;
                                            }
                                            finally
                                            {
                                                Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Foreign Advance Request has been sent for account payment approval.!');window.open('../../Portal/SCIL/Home.aspx','frmset_WorkArea');}</script>");
                                            }
                                        }
                                    }
                                    else
                                    {
                                        Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Release Step Not Found ...!');window.open('../../Portal/SCIL/TaskDetails.aspx','frmset_WorkArea');}</script>");
                                    }
                                }
                            }
                        }
                        else
                        {
                            Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Accounts For Payment Approval Not Found.!');}</script>");
                        }
                    }
                }
                else if (ddlAction.SelectedItem.Text == "Reject")
                {
                    txt_Condition.Text = "2";
                    txt_Audit.Text     = "FOREIGN ADVANCE REQUEST DEVIATION APPROVAL";
                    string isSaved = (string)ActionController.ExecuteAction("", "Foreign_Advance_Request_Approval.aspx", "update", ref ref_data, Convert.ToInt32(txt_Condition.Text), txtProcessID.Text, txtInstanceID.Text, txt_Audit.Text, txt_Username.Text, spn_Remark.InnerHtml, ddlAction.SelectedItem.Text);
                    if (isSaved == null || ref_data.Length > 0 || isSaved == "false")
                    {
                        string[] errmsg = ref_data.Split(':');
                        Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('" + errmsg[0].ToString() + "');}</script>");
                    }
                    else
                    {
                        string[] Dval = new string[1];
                        Dval[0] = txt_Username.Text;
                        string ref_data1  = string.Empty;
                        string release_id = (string)ActionController.ExecuteAction("", "Foreign_Advance_Request.aspx", "getreleaseid", ref ref_data1, txtProcessID.Text, step_name.Text, "REJECT");
                        if (release_id != "")
                        {
                            bool isCreate = (bool)WFE.Action.ReleaseStep(txtProcessID.Text, txtInstanceID.Text, release_id, step_name.Text, "REJECT", txt_Username.Text, txt_Username.Text.Trim(), "", "", "", "", "", "", "", "", "", "", Dval, txt_Request.Text, txtWIID.Text, ref isInserted);
                            if (isCreate)
                            {
                                try
                                {
                                    string msg = "<pre><font size='3'>Dear Sir/Madam,</font></pre><p/> <pre><font size='3'>Foreign Advance Request has been Rejected.</font></pre><p/> <pre><font size='3'>Request No: " + spn_req_no.Text + "</font></pre> <pre><font size='3'>Created By: " + lbl_EmpName.Text.Trim() + "</font></pre></p><pre></b><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><pre></pre><br/><pre><font size='3'  color='red'><i><b>This is a system generated message. We request you not to reply to this message.</b></i></font></pre>";

                                    string emailid = (string)ActionController.ExecuteAction(txt_Username.Text, "Foreign_Advance_Request.aspx", "insetmaildata", ref isInserted, txtProcessID.Text, txtInstanceID.Text, 0, "FOREIGN ADVANCE REQUEST DEVIATION APPROVAL", "REJECT", Init_Email.Text, "", msg, "Request No: " + spn_req_no.Text);
                                }
                                catch (Exception)
                                {
                                    throw;
                                }
                                finally
                                {
                                    Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Foreign Advance Request has been Rejected.');window.open('../../Portal/SCIL/Home.aspx','frmset_WorkArea');}</script>");
                                }
                            }
                        }
                        else
                        {
                            Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Release Step Not Found ...!');window.open('../../Portal/SCIL/TaskDetails.aspx','frmset_WorkArea');}</script>");
                        }
                    }
                }
                else if (ddlAction.SelectedItem.Text == "Send-Back")
                {
                    txt_Condition.Text = "3";
                    txt_Audit.Text     = "FOREIGN ADVANCE REQUEST DEVIATION APPROVAL";
                    string isSaved = (string)ActionController.ExecuteAction("", "Foreign_Advance_Request_Approval.aspx", "update", ref ref_data, Convert.ToInt32(txt_Condition.Text), txtProcessID.Text, txtInstanceID.Text, txt_Audit.Text, txt_Username.Text, spn_Remark.InnerHtml, ddlAction.SelectedItem.Text);
                    if (isSaved == null || ref_data.Length > 0 || isSaved == "false")
                    {
                        string[] errmsg = ref_data.Split(':');
                        Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('" + errmsg[0].ToString() + "');}</script>");
                    }
                    else
                    {
                        string[] Dval = new string[1];
                        Dval[0] = initiator.Text;
                        string ref_data1  = string.Empty;
                        string release_id = (string)ActionController.ExecuteAction("", "Foreign_Advance_Request.aspx", "getreleaseid", ref ref_data1, txtProcessID.Text, step_name.Text, "SEND-BACK");
                        if (release_id != "")
                        {
                            bool isCreate = (bool)WFE.Action.ReleaseStep(txtProcessID.Text, txtInstanceID.Text, release_id, step_name.Text, "SEND-BACK", txt_Username.Text, txt_approvar.Text.Trim(), "", "", "", "", "", "", "", "", "", "", Dval, txt_Request.Text, txtWIID.Text, ref isInserted);
                            if (isCreate)
                            {
                                try
                                {
                                    string msg = "<pre><font size='3'>Dear Sir/Madam,</font></pre><p/> <pre><font size='3'>Foreign Advance Request has been Sent back to the initiator.</font></pre><p/> <pre><font size='3'>Request No: " + spn_req_no.Text + "</font></pre> <pre><font size='3'>Created By: " + lbl_EmpName.Text.Trim() + "</font></pre></p><pre></b><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><pre></pre><br/><pre><font size='3'  color='red'><i><b>This is a system generated message. We request you not to reply to this message.</b></i></font></pre>";

                                    string emailid = (string)ActionController.ExecuteAction(txt_Username.Text, "Foreign_Advance_Request.aspx", "insetmaildata", ref isInserted, txtProcessID.Text, txtInstanceID.Text, 0, "FOREIGN ADVANCE REQUEST DEVIATION APPROVAL", "SEND-BACK", Init_Email.Text, "", msg, "Request No: " + spn_req_no.Text);
                                }
                                catch (Exception)
                                {
                                    throw;
                                }
                                finally
                                {
                                    Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Foreign Advance Request has been Sent back to the initiator...!');window.open('../../Portal/SCIL/Home.aspx','frmset_WorkArea');}</script>");
                                }
                            }
                        }
                        else
                        {
                            Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Release Step Not Found ...!');window.open('../../Portal/SCIL/TaskDetails.aspx','frmset_WorkArea');}</script>");
                        }
                    }
                }
            }
        }
        catch (Exception ex)
        {
            FSL.Logging.Logger.WriteEventLog(false, ex);
        }
    }
    protected void LoginUser()
    {
        string    strPasswordmd5 = "";
        DataTable dt             = new DataTable();

        objLogin.Username = Login1.UserName;
        string  pass       = hdnEncpass.Value;
        TextBox txtboxPass = (TextBox)Login1.FindControl("Password");
        TextBox txtboxUser = (TextBox)Login1.FindControl("UserName");

        if (Request.Cookies["myScrlCookie"] != null && objLogin.Username == Request.Cookies.Get("myScrlCookie").Values["UserName"].ToString())
        {
            CryptoGraphy objdcryptt   = new CryptoGraphy();
            HttpCookie   myScrlCookie = new HttpCookie("myScrlCookie");
            myScrlCookie    = Request.Cookies.Get("myScrlCookie");
            Login1.UserName = myScrlCookie.Values["UserName"].ToString();
            TextBox txtbox = (TextBox)Login1.FindControl("Password");
            pass = myScrlCookie.Values["Password"].ToString();
        }

        dt = objLoginDB.GetDataSet(objLogin, DA_SKORKEL.DA_Login.Login_1.UserLoginMD5);//UserLogin);
        if (dt.Rows.Count > 0)
        {
            string    strPassword = objEncrypt.Decrypt(Convert.ToString(dt.Rows[0]["vchrPassword"]));
            DataTable dtmd5       = new DataTable();
            objLogin.Password = strPassword;
            dtmd5             = objLoginDB.GetDataSet(objLogin, DA_Login.Login_1.GetMD5);
            if (dtmd5.Rows.Count > 0)
            {
                strPasswordmd5 = Convert.ToString(dtmd5.Rows[0]["strPasswordMD5"]);
            }
            if (strPasswordmd5 == pass)
            {
                if (Login1.RememberMeSet == true)
                {
                    HttpCookie myScrlCookie = new HttpCookie("myScrlCookie");
                    //Response.Cookies.Remove("myScrlCookie");
                    myScrlCookie.Values.Add("UserID", Convert.ToString(dt.Rows[0]["intRegistrationId"]));
                    myScrlCookie.Values.Add("UserName", Login1.UserName.ToString());
                    myScrlCookie.Values.Add("Password", Login1.Password.ToString());
                    DateTime dtxpiry = DateTime.Now.AddDays(15);

                    myScrlCookie.Expires  = dtxpiry;
                    myScrlCookie.HttpOnly = false;
                    Response.Cookies.Add(myScrlCookie);
                }

                UserSession.UserInfo UInfo = new UserSession.UserInfo();
                string LoginName           = Convert.ToString(dt.Rows[0]["LoginName"]);
                UInfo.UserName = Convert.ToString(dt.Rows[0]["vchrUserName"]);
                UInfo.UserID   = Convert.ToInt64(dt.Rows[0]["intRegistrationId"]);
                int TypeId = Convert.ToInt32(dt.Rows[0]["intUserTypeID"]);
                Session.Add("UserTypeId", TypeId);
                Session.Add("UInfo", UInfo);
                Session.Add("LoginName", LoginName);
                Session.Add("ExternalUserId", Convert.ToString(dt.Rows[0]["intRegistrationId"]));
                //Added On 16 March 2020
                Session.Add("isScorePrivate", dt.Rows[0]["bitIsScorePrivate"]);
                objLogin.intRegistartionID = Convert.ToInt32(dt.Rows[0]["intRegistrationId"]);
                objLoginDB.AddAndGetLoginDetails(objLogin, DA_SKORKEL.DA_Login.Login_1.Login);

                if (ISAPIURLACCESSED != "0")
                {
                    try
                    {
                        string ip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
                        if (ip == null)
                        {
                            ip = Request.ServerVariables["REMOTE_ADDR"];
                        }
                        String url = APIURL + "userLogin.action?" +
                                     "loginUid=" + dt.Rows[0]["intUserTypeID"] + dt.Rows[0]["intRegistrationId"] +
                                     "&loginId=" + dt.Rows[0]["intRegistrationId"] +
                                     "&password="******"&loginTime=" + DateTime.Now +
                                     "&sessionId=" + HttpContext.Current.Session.SessionID;

                        HttpWebRequest myRequest1 = (HttpWebRequest)WebRequest.Create(url);
                        myRequest1.Method = "GET";
                        if (ISAPIResponse != "0")
                        {
                            WebResponse  myResponse1 = myRequest1.GetResponse();
                            StreamReader sr          = new StreamReader(myResponse1.GetResponseStream(), System.Text.Encoding.UTF8);
                            String       result      = sr.ReadToEnd();

                            objAPILogDO.strURL       = url;
                            objAPILogDO.strAPIType   = "User Login";
                            objAPILogDO.strResponse  = result;
                            objAPILogDO.strIPAddress = ip;
                            objAPILogDO.intAddedBy   = Convert.ToInt32(ViewState["UserID"]);
                            objAPILogDA.AddEditDel_Scrl_APILogDetailsTbl(objAPILogDO, DA_Scrl_APILogDetailsTbl.Scrl_APILogDetailsTbl.Insert);
                        }
                    }
                    catch { }
                }
                if (Convert.ToString(dt.Rows[0]["logintimestamp"]) != null && Convert.ToString(dt.Rows[0]["logintimestamp"]) != "")
                {
                    Response.Redirect("Home.aspx?ActiveStatus=P");
                }
                else
                {
                    Response.Redirect("SignUp3.aspx");
                }

                //Response.Redirect("SignUp3.aspx");
            }
            else
            {
                // Remeber me cookie Removed
                TextBox txtbox = (TextBox)Login1.FindControl("Password");
                txtbox.Text = string.Empty;
                Response.Cookies["myScrlCookie"].Expires = DateTime.Now.AddDays(-1);
                HttpCookie myScrlAppCookie = new HttpCookie("myScrlAppCookie");

                myScrlAppCookie.Value = "logout";

                myScrlAppCookie.HttpOnly = false;
                Response.Cookies.Add(myScrlAppCookie);

                divLogin.Style.Add("display", "block");
                //Login1.FailureText = "Invalid user.";


                Label FailureText = (Label)Login1.FindControl("FailureText");
                FailureText.Visible = true;
                FailureText.Text    = "Invalid email or password.";
                openLoginPopup();
                //divSuccess.Style.Add("display", "block");
            }
        }
        else
        {
            divLogin.Style.Add("display", "block");
            //Login1.FailureText = "Invalid user.";
            //divSuccess.Style.Add("display", "block");
            Label FailureText = (Label)Login1.FindControl("FailureText");
            FailureText.Visible = true;
            FailureText.Text    = "Invalid email or password.";
            openLoginPopup();
        }
    }
    public string get_BulkRequests(string name, int pageno, int rpp, string status, string fdate, string tdate)
    {
        StringBuilder tblHeader = new StringBuilder();
        StringBuilder tblBody   = new StringBuilder();
        string        tblHTML   = string.Empty;
        DataTable     DT        = new DataTable();
        string        username  = Convert.ToString(Session["USER_ADID"]);
        string        isData    = string.Empty;

        try
        {
            DT = (DataTable)ActionController.ExecuteAction("", "Request_Status_Report.aspx", "getmyexpenserequest", ref isData, username, name, status, fdate, tdate);

            tblHeader.Append("<th>#</th><th>Request No.</th><th>Date</th><th>Payment Mode</th><th>Payable(+)/Receivable(-) Amount</th><th>Request Status</th><th>To Whom (Approver)</th><th>Documents</th><th>Voucher</th>");
            int ddl = rpp;
            if (pageno == 0)
            {
                pageno = 1;
            }
            int from = (pageno - 1) * ddl;
            int to   = ((pageno - 1) * ddl) + ddl;
            for (int i = from; i < to; i++)
            {
                if (i < DT.Rows.Count)
                {
                    string compname     = ConfigurationManager.AppSettings["COMPNAME"].ToString();
                    string param_Pro    = "";
                    string param_req    = "";
                    string voucher_link = "";
                    string dummy        = "";
                    if (Convert.ToString(DT.Rows[i]["process_name"]).ToUpper() == "CAR POLICY")
                    {
                        param_Pro    = "";
                        param_req    = Convert.ToString(DT.Rows[i]["REQUEST_NO"]);
                        voucher_link = "http://" + compname + "/Sudarshan-Portal/Vouchers/Car_Voucher.aspx?P=" + param_Pro + "&R=" + param_req;
                    }
                    else if (Convert.ToString(DT.Rows[i]["process_name"]).ToUpper() == "ADVANCE REQUEST FOREIGN")
                    {
                        param_Pro    = "";
                        param_req    = Convert.ToString(DT.Rows[i]["REQUEST_NO"]);
                        voucher_link = "http://" + compname + "/Sudarshan-Portal/Vouchers/Foreign_Advance.aspx?P=" + param_Pro + "&R=" + param_req;
                    }
                    else if (Convert.ToString(DT.Rows[i]["process_name"]).ToUpper() == "FOREIGN TRAVEL EXPENSE")
                    {
                        param_Pro    = "";
                        param_req    = Convert.ToString(DT.Rows[i]["REQUEST_NO"]);
                        voucher_link = "http://" + compname + "/Sudarshan-Portal/Vouchers/Foreign_Voucher.aspx?P=" + param_Pro + "&R=" + param_req;
                    }
                    else
                    {
                        CryptoGraphy crypt = new CryptoGraphy();
                        if (Convert.ToString(DT.Rows[i]["process_name"]) == "ADVANCE REQUEST")
                        {
                            dummy = "ADVANCE EXPENSE";
                        }
                        else
                        {
                            dummy = Convert.ToString(DT.Rows[i]["process_name"]);
                        }
                        param_Pro = crypt.Encryptdata(Convert.ToString(DT.Rows[i]["process_name"]));
                        param_req = crypt.Encryptdata(Convert.ToString(DT.Rows[i]["REQUEST_NO"]));
                        if (Convert.ToString(DT.Rows[i]["PAYMENT_MODE"]).ToUpper() == "CASH")
                        {
                            voucher_link = "http://" + compname + "/Sudarshan-Portal/Vouchers/Cash_Voucher.aspx?P=" + param_Pro + "&R=" + param_req;
                        }
                        else
                        {
                            voucher_link = "http://" + compname + "/Sudarshan-Portal/Vouchers/Bank_Voucher.aspx?P=" + param_Pro + "&R=" + param_req;
                        }
                    }


                    //<a href='https://" + compname + "/Sudarshan-Portal/Vouchers/Cash_Voucher.aspx?P=" + process_name + "&R=" + req_no + "'>https://" + compname + "/Sudarshan-Portal/Vouchers/Cash_Voucher.aspx?P=" + process_name + "&R=" + req_no + "</a>

                    tblBody.Append("<tr><td align='center'><input type='text' id='fk_process" + (i + 1) + "' Value=" + Convert.ToString(DT.Rows[i]["FK_PROCESS_ID"]) + " style='display:none'/><input type='text' id='pname" + (i + 1) + "' Value='" + Convert.ToString(DT.Rows[i]["process_name"]) + "' style='display:none'/><input type='text' id='h_info" + (i + 1) + "' Value='" + Convert.ToString(DT.Rows[i]["REQUEST_NO"]) + "' style='display:none'/></input><input type='text' id='iid" + (i + 1) + "' Value=" + Convert.ToString(DT.Rows[i]["FK_INSTANCE_ID"]) + " style='display:none'></input><input type='text' id='wiid" + (i + 1) + "' Value='" + Convert.ToString(DT.Rows[i]["PK_TRANSID"]) + "' style='display:none'></input>" + (i + 1) + "</td><td><a href='#req_Details' role='button' data-toggle='modal' id='req_no" + (i + 1) + "' onclick='getRequestDetails(" + (i + 1) + ")'>" + Convert.ToString(DT.Rows[i]["request_no"]) + "</a></td><td align='center'>" + Convert.ToString(DT.Rows[i]["created_date"]) + "</td><td align='center'>" + DT.Rows[i]["PAYMENT_MODE"].ToString() + "</td><td align='right'>" + DT.Rows[i]["Amount"].ToString() + "</td><td align='center'>" + DT.Rows[i]["status"].ToString() + "</td><td>" + DT.Rows[i]["Approver"].ToString() + "</td><td align='center'><a href='#Documents' role='button' data-toggle='modal' onclick='Bind_Documents(" + Convert.ToString(DT.Rows[i]["PK_TRANSID"]) + "," + Convert.ToString(DT.Rows[i]["fk_process_id"]) + ")'>View</a></td><td><a href='#' onclick=download_Link('" + voucher_link + "','" + Convert.ToString(DT.Rows[i]["REQUEST_NO"]) + "')>Voucher Print</a></td></tr>");
                }
            }
            tblHTML = "<table id='tbl_WorkItems' class='table table-bordered' align='center' width='100%'>" +
                      "<thead><tr class='grey'>" + tblHeader.ToString() + "</tr></thead>" +
                      "<tbody>" + tblBody.ToString() + "</tbody>" +
                      "</table>";

            StringBuilder HTML = new StringBuilder();
            double        cnt  = Convert.ToDouble(DT.Rows.Count) / ddl;
            if (cnt > Convert.ToInt16(Convert.ToInt32(DT.Rows.Count) / ddl))
            {
                cnt = (int)cnt + 1;
            }

            if (cnt > 1)
            {
                HTML.Append("<div class='dataTables_paginate paging_simple_numbers' style='text-align:center'>");
                HTML.Append("<ul class='pagination'>");
                for (int j = 1; j <= cnt; j++)
                {
                    HTML.Append("<li class='paginate_button' style='margin:2px;'><input type='button' value='" + j + "' class='btn btn-default buttons-copy buttons-flash' style=' font-weight:normal' onclick='gotopage1(this," + ddl + ")'></li>");
                }
                HTML.Append("</ul></div>");
            }
            tblHTML = tblHTML + Convert.ToString(HTML);
        }
        catch (Exception Exc) { Logger.WriteEventLog(false, Exc); }
        return(Convert.ToString(tblHTML));
    }
    protected void btnRequest_Click(object sender, EventArgs e)
    {
        try
        {
            ActionController.DisablePageCaching(this);
            if (ActionController.IsSessionExpired(this))
            {
                ActionController.RedirctToLogin(this);
            }
            else
            {
                divIns.Style.Add("display", "none");
                string ISValid1 = string.Empty;
                string ISValid2 = string.Empty;
                string success  = string.Empty;
                success = "FALSE";
                string dtamt = string.Empty; string ss = string.Empty; string ss1 = string.Empty;
                //string vtype2 = string.Empty; string vfrom2 = string.Empty; string vto3 = string.Empty; string vdate3 = string.Empty;
                //string vtype3 = string.Empty; string vfrom3 = string.Empty; string vto2 = string.Empty; string vdate2 = string.Empty;
                string vehiclexml_string = txt_xml_data_vehicle.Text;
                vehiclexml_string         = vehiclexml_string.Replace("&", "&amp;");
                vehiclexml_string         = vehiclexml_string.Replace(">", "&gt;");
                vehiclexml_string         = vehiclexml_string.Replace("<", "&lt;");
                vehiclexml_string         = vehiclexml_string.Replace("||", ">");
                vehiclexml_string         = vehiclexml_string.Replace("|", "<");
                vehiclexml_string         = vehiclexml_string.Replace("[", "&lt;");
                vehiclexml_string         = vehiclexml_string.Replace("]", "&lt;");
                vehiclexml_string         = vehiclexml_string.Replace("'", "&apos;");
                txt_xml_data_vehicle.Text = vehiclexml_string.ToString();
                //int days1 = 0;
                //DataTable days = (DataTable)ActionController.ExecuteAction("", "Mobile_DataCard_Expense.aspx", "selectdetails", ref ISValid2, "Local Conveyance", "AdDays");
                //if (days != null && days.Rows.Count > 0)
                //{
                //    days1 = Convert.ToInt16(days.Rows[0]["Days"].ToString());
                //}
                string      vtype = string.Empty;
                string      vto   = string.Empty;
                string      vfrom = string.Empty;
                XmlDocument xml   = new XmlDocument();
                xml.LoadXml(txt_xml_data_vehicle.Text);
                XmlNodeList xnList = xml.SelectNodes("/ROWSET/ROW");
                for (int k = 0; k < xnList.Count; k++)
                {
                    //    vtype2 = vfrom2 = vto2 = vdate2= "";
                    vtype = xnList[k].ChildNodes.Item(1).InnerText.Trim();
                    vfrom = xnList[k].ChildNodes.Item(5).InnerText.Trim();
                    vto   = xnList[k].ChildNodes.Item(6).InnerText.Trim();

                    //    string vdate = xnList[k].ChildNodes.Item(5).InnerText.Trim();
                    //    if (k < xnList.Count - 1)
                    //    {
                    //        vtype3 = vfrom3 = vto3 = vdate3 ="";
                    //        vtype2 = xnList[k + 1].ChildNodes.Item(1).InnerText.Trim();
                    //        vfrom2 = xnList[k + 1].ChildNodes.Item(2).InnerText.Trim();
                    //        vto2 = xnList[k + 1].ChildNodes.Item(3).InnerText.Trim();
                    //        vdate2 = xnList[k + 1].ChildNodes.Item(5).InnerText.Trim();
                    //        if ((k + 1) < xnList.Count - 1)
                    //        {
                    //            vtype3 = xnList[k + 2].ChildNodes.Item(1).InnerText.Trim();
                    //            vfrom3 = xnList[k + 2].ChildNodes.Item(2).InnerText.Trim();
                    //            vto3 = xnList[k + 2].ChildNodes.Item(3).InnerText.Trim();
                    //            vdate3 = xnList[k + 2].ChildNodes.Item(5).InnerText.Trim();
                    //        }
                    //    }
                    //System.DateTime firstDate = DateTime.Today;
                    //System.DateTime secondDate = Convert.ToDateTime(vdate);
                    //System.TimeSpan diff = secondDate.Subtract(firstDate);
                    //System.TimeSpan diff1 = secondDate - firstDate;
                    //int diff2 = Convert.ToInt16((secondDate - firstDate).TotalDays.ToString());
                    //if (days1 < diff2)
                    //{
                    //    ss += vbillno + " / ";
                    //    success = "DIFFDAYS";

                    //}

                    //if ((vtype == vtype2 && vfrom == vfrom2 && vto == vto2 && vdate==vdate2) || (vtype3 == vtype2 && vfrom2 == vfrom3 && vto2 == vto3 && vdate2==vdate3) || (vtype == vtype3 && vfrom == vfrom3 && vto == vto3 && vdate==vdate3))
                    //{
                    //    if ((vtype2 != "" || vtype3 != "") && (vfrom2 != "" || vfrom3 != "") && (vto2 != "" || vto3 != "") && (vdate2 != "" || vdate3 != ""))
                    //    {
                    //        success = "SAME";
                    //    }
                    //}
                    //else
                    //{
                    dtamt = (string)ActionController.ExecuteAction("", "Local_Conveyance.aspx", "checkduplicate", ref ISValid1, vto, vtype, vfrom, txt_Username.Text);
                    if (dtamt != "false")
                    {
                        ss1    += dtamt + " / ";
                        success = "TRUE";
                    }
                    //}
                }
                //if (success == "DIFFDAYS")
                //{
                //    string message = "alert('You do not have permission to submit the bill for :" + ss + "  bill no..!')";
                //    ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", message, true);
                //}
                if (success == "TRUE")
                {
                    string message = "alert('You have Already Submitted Bill For FromDate or TODate')";
                    //string message = "alert('You have Already Submitted Bill For This Period :" + ss1 + "')";
                    ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", message, true);
                }
                //if (success == "SAME")
                //{
                //    string message = "alert('You have entered same local coneyance for the same day!')";
                //    ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", message, true);
                //}
                if (success == "FALSE")
                {
                    if (txt_approvar.Text != "NA")
                    {
                        string refData    = string.Empty;
                        string isInserted = string.Empty;
                        string ISValid    = string.Empty;
                        string isSaved    = string.Empty;
                        txt_Condition.Text = "1";
                        txt_Action.Text    = "Submit";
                        bool isCreate = false;

                        string inserXML = txt_Document_Xml.Text;
                        inserXML = inserXML.Replace("&", "&amp;");
                        txt_Document_Xml.Text = inserXML.ToString();
                        txt_Audit.Text        = "LOCAL CONVEYANCE";
                        string instanceID = (string)WFE.Action.StartCase(isInserted, txtProcessID.Text, txt_Username.Text, txt_Username.Text, txtEmailID.Text, "128");
                        txtInstanceID.Text = instanceID;

                        if (ddlPayMode.SelectedValue == "2")
                        {
                            ddlLocation.SelectedValue = "0";
                        }
                        isSaved = (string)ActionController.ExecuteAction("", "Local_Conveyance.aspx", "insert", ref refData, Convert.ToInt32(txtProcessID.Text), Convert.ToInt32(txtInstanceID.Text), ddlPayMode.SelectedValue, txt_xml_data_vehicle.Text, txt_Username.Text, txt_remark.Value, txt_Audit.Text, txt_Action.Text, txt_approvar.Text, txt_Document_Xml.Text, ddlLocation.SelectedValue, txt_advance_id.Text, txt_pkexpenseid.Text);
                        if (isSaved == null || refData.Length > 0 || isSaved == "false")
                        {
                            string[] errmsg = refData.Split(':');
                            ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", "alert('" + errmsg[1].ToString() + "')", true);
                        }
                        else
                        {
                            string[] Request_Unique = isSaved.Split('=');
                            txt_Request.Text = Request_Unique[0];
                            string    isValid1 = string.Empty;
                            string[]  arr      = new string[100];
                            DataTable dt       = (DataTable)ActionController.ExecuteAction("", "Local_Conveyance.aspx", "getrequest_document", ref isValid1, "LOCAL CONVEYANCE", Request_Unique[0]);
                            if (dt.Rows.Count > 0)
                            {
                                string activeDir  = ConfigurationManager.AppSettings["DOCPATH"].ToString().Trim();
                                string path       = string.Empty;
                                string foldername = Request_Unique[0];
                                foldername = foldername.Replace("/", "_");
                                path       = activeDir + "\\" + "LOCAL CONVEYANCE\\" + foldername;
                                if (Directory.Exists(path))
                                {
                                }
                                else
                                {
                                    Directory.CreateDirectory(path);
                                    //string[] directories = Directory.GetDirectories(activeDir);
                                    string[] directories = Directory.GetFiles(activeDir + "\\" + "LOCAL CONVEYANCE\\");
                                    path = path + "\\";
                                    foreach (var directory in directories)
                                    {
                                        for (int i = 0; i < dt.Rows.Count; i++)
                                        {
                                            var sections = directory.Split('\\');
                                            var fileName = sections[sections.Length - 1];
                                            if (dt.Rows[i]["filename"].ToString().Trim() == fileName)
                                            {
                                                System.IO.File.Move(activeDir + "\\" + "LOCAL CONVEYANCE\\" + fileName, path + fileName);
                                                if (System.IO.File.Exists(activeDir + "\\" + "LOCAL CONVEYANCE\\" + fileName))
                                                {
                                                    System.IO.File.Delete(activeDir + "\\" + "LOCAL CONVEYANCE\\" + fileName);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            if (lbl_EmpCode.Text == "10000" || lbl_EmpCode.Text == "10001")
                            {
                                string       msg          = "";
                                string       ref_data     = string.Empty;
                                string       emailid      = string.Empty;
                                CryptoGraphy crypt        = new CryptoGraphy();
                                string       process_name = crypt.Encryptdata("LOCAL CONVEYANCE");
                                string       req_no       = crypt.Encryptdata(txt_Request.Text);
                                DataTable    DTAP         = new DataTable();

                                if (ddlPayMode.SelectedItem.Text.ToUpper() == "CASH")
                                {
                                    DTAP = (DataTable)ActionController.ExecuteAction("", "Local_Conveyance_Approval.aspx", "getaccapprover", ref ref_data, "LOCAL CONVEYANCE ACCOUNT PAYMENT APPROVAL", ddlLocation.SelectedValue, ddlPayMode.SelectedValue);
                                }
                                else
                                {
                                    DTAP = (DataTable)ActionController.ExecuteAction("", "Local_Conveyance_Approval.aspx", "getaccapprover", ref ref_data, "LOCAL CONVEYANCE ACCOUNT PAYMENT APPROVAL", 0, ddlPayMode.SelectedValue);
                                }
                                if (DTAP != null)
                                {
                                    if (DTAP.Rows.Count > 0)
                                    {
                                        txt_Condition.Text = "3";
                                        string isSaved1 = (string)ActionController.ExecuteAction("", "Local_Conveyance.aspx", "inserttwi", ref ref_data, txtProcessID.Text, txtInstanceID.Text, txt_Username.Text, txt_Request.Text, "2");
                                        if (isSaved1 == null || ref_data.Length > 0 || isSaved1 == "false")
                                        {
                                            string[] errmsg = ref_data.Split(':');
                                            Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('" + errmsg[1].ToString() + "');}</script>");
                                        }
                                        else
                                        {
                                            string[] Dval = new string[DTAP.Rows.Count];
                                            Dval[0] = "";
                                            if (DTAP.Rows.Count > 0)
                                            {
                                                for (int i = 0; i < DTAP.Rows.Count; i++)
                                                {
                                                    Dval[i] = Convert.ToString(DTAP.Rows[i]["USER_ADID"]);
                                                    if (txtApproverEmail.Text == "")
                                                    {
                                                        txtApproverEmail.Text = Convert.ToString(DTAP.Rows[i]["EMAIL_ID"]);
                                                    }
                                                    else
                                                    {
                                                        txtApproverEmail.Text = txtApproverEmail.Text + ',' + Convert.ToString(DTAP.Rows[i]["EMAIL_ID"]);
                                                    }
                                                }
                                            }
                                            bool isCreate1 = (bool)WFE.Action.ReleaseStep(txtProcessID.Text, txtInstanceID.Text, "130", "LOCAL CONVEYANCE APPROVAL", "SUBMIT", txt_Username.Text, txt_Username.Text.Trim(), "", "", "", "", "", "", "", "", "", "", Dval, txt_Request.Text, "0", ref isInserted);
                                            if (isCreate1)
                                            {
                                                try
                                                {
                                                    if ((txt_Approver_Email.Text != "") && (txtEmailID.Text != ""))
                                                    {
                                                        if (ddlPayMode.SelectedItem.Text.ToUpper() == "CASH")
                                                        {
                                                            msg     = "<pre><font size='3'>Dear Sir/Madam,</font></pre><p/> <pre><font size='3'>Local Conveyance Request has been sent to Accounts for payment approval..</font></pre><p/> <pre><font size='3'>Request No: " + txt_Request.Text + "</font></pre> <pre><font size='3'>Created By: " + txt_Request.Text.Trim() + "</font></pre></p><pre><span style='font-size: medium;'>Please Take Voucher Print By Link Given Below : </span></pre><pre><span style='font-size: medium;'>INTRANET URL:http://espuat/Sudarshan-Portal/Vouchers/Cash_Voucher.aspx?P=" + process_name + "&R=" + req_no + "</span></pre><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><br/><pre>Regards</pre><pre><b>Reporting Admin<b></pre><br/><pre></pre><br/><pre><font size='3'  color='red'><i><b>This is a system generated message. We request you not to reply to this message.</b></i></font></pre>";
                                                            emailid = (string)ActionController.ExecuteAction(txt_Username.Text, "Local_Conveyance.aspx", "insetmaildata", ref isInserted, txtProcessID.Text, txtInstanceID.Text, 0, "LOCAL CONVEYANCE APPROVAL", "SUBMIT", txt_Approver_Email.Text, txtEmailID.Text, msg, "Request No: " + txt_Request.Text);
                                                        }
                                                        else
                                                        {
                                                            msg     = "<pre><font size='3'>Dear Sir/Madam,</font></pre><p/> <pre><font size='3'>Local Conveyance Request has been sent to Accounts for payment approval..</font></pre><p/> <pre><font size='3'>Request No: " + txt_Request.Text + "</font></pre> <pre><font size='3'>Created By: " + txt_Request.Text.Trim() + "</font></pre></p><pre><span style='font-size: medium;'>Please Take Voucher Print By Link Given Below : </span></pre><pre><span style='font-size: medium;'>INTRANET URL:http://espuat/Sudarshan-Portal/Vouchers/Bank_Voucher.aspx?P=" + process_name + "&R=" + req_no + "</span></pre><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><br/><pre>Regards</pre><pre><b>Reporting Admin<b></pre><br/><pre></pre><br/><pre><font size='3'  color='red'><i><b>This is a system generated message. We request you not to reply to this message.</b></i></font></pre>";
                                                            emailid = (string)ActionController.ExecuteAction(txt_Username.Text, "Local_Conveyance.aspx", "insetmaildata", ref isInserted, txtProcessID.Text, txtInstanceID.Text, 0, "LOCAL CONVEYANCE APPROVAL", "SUBMIT", txt_Approver_Email.Text, txtEmailID.Text, msg, "Request No: " + txt_Request.Text);
                                                        }
                                                    }
                                                }
                                                catch (Exception)
                                                {
                                                    throw;
                                                }
                                                finally
                                                {
                                                    string msg2 = string.Empty;
                                                    msg2 = "alert('Local Conveyance has been sent for account payment approval and Request No. is : " + txt_Request.Text + " ...!');window.open('../../Portal/SCIL/Home.aspx','frmset_WorkArea')";
                                                    ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", msg2, true);
                                                }
                                            }
                                        }//
                                    }
                                    else
                                    {
                                        string msg2 = string.Empty;
                                        msg2 = "alert('Account Payment Approver Not Available For " + ddlPayMode.SelectedItem.Text + " Payment Mode...!');window.open('../../Portal/SCIL/TaskDetails.aspx','frmset_WorkArea')";
                                        ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", msg2, true);
                                    }
                                }
                                else
                                {
                                    string msg2 = string.Empty;
                                    msg2 = "alert('Account Payment Approver Not Available For " + ddlPayMode.SelectedItem.Text + " Payment Mode...!');window.open('../../Portal/SCIL/TaskDetails.aspx','frmset_WorkArea')";
                                    ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", msg2, true);
                                }
                            }
                            else
                            {
                                string[] Dval1 = new string[1];
                                Dval1[0] = txt_approvar.Text;

                                if (txt_Approver_Email.Text == "")
                                {
                                    txt_Approver_Email.Text = txtEmailID.Text;
                                }
                                isCreate = (bool)WFE.Action.ReleaseStep(txtProcessID.Text, txtInstanceID.Text, "129", "LOCAL CONVEYANCE REQUEST", "SUBMIT", txt_Username.Text, txt_Username.Text.Trim(), "", "", "", "", "", "", "", "", "", "", Dval1, txt_Request.Text, "0", ref isInserted);
                                if (isCreate)
                                {
                                    try
                                    {
                                        if (((txt_Approver_Email.Text != "NA") || (txt_Approver_Email.Text != "")) && (txtEmailID.Text != ""))
                                        {
                                            string emailid = string.Empty;
                                            string msg     = "<pre><font size='3'>Dear Sir/Madam,</font></pre><p/> <pre><font size='3'>The Local Conveyance Request has been sent for your approval.</font></pre><p/></b><pre><font size='3'>Request No: " + txt_Request.Text + "</font></pre><pre><font size='3'>Created By: " + lbl_EmpName.Text.Trim() + "</font></pre></p><pre></b><pre>URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><br/><pre>Regards</pre><pre><b>Reporting Admin<b></pre><br/><pre></pre><br/><pre><font size='3'  color='red'><i><b>This is a system generated message. We request you not to reply to this message.</b></i></font></pre>";
                                            emailid = (string)ActionController.ExecuteAction(txt_Username.Text, "Local_Conveyance.aspx", "insetmaildata", ref isInserted, txtProcessID.Text, txtInstanceID.Text, 0, "LOCAL CONVEYANCE REQUEST", "SUBMIT", txt_Approver_Email.Text, txtEmailID.Text, msg, "Request No: " + txt_Request.Text);
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        FSL.Logging.Logger.WriteEventLog(false, ex);
                                    }
                                    finally
                                    {
                                        string message = "alert('Local Conveyance Request has been Sent Successfully and Request No. is : " + txt_Request.Text + " ...!');window.open('../../Portal/SCIL/Home.aspx','frmset_WorkArea');";
                                        ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", message, true);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        string msg = "alert('Approver Not Available...!');window.open('../../Portal/SCIL/TaskDetails.aspx','frmset_WorkArea')";
                        ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "alert", msg, true);
                    }
                }
            }
        }
        catch (Exception ex)
        {
            FSL.Logging.Logger.WriteEventLog(false, ex);
        }
    }
Beispiel #20
0
    protected void btnRequest_Click(object sender, EventArgs e)
    {
        try
        {
            ActionController.DisablePageCaching(this);
            if (ActionController.IsSessionExpired(this))
            {
                ActionController.RedirctToLogin(this);
            }
            else
            {
                string remark = txtRemark.Value;



                string isInserted = string.Empty;
                string ref_data   = string.Empty;
                txt_Audit.Text = "SERVICE PO APPROVAL";
                if (ddlAction.SelectedItem.Text == "Approve")
                {
                    string       msg     = "";
                    string       emailid = string.Empty;
                    CryptoGraphy crypt   = new CryptoGraphy();
                    string       req_no  = crypt.Encryptdata(txt_Request.Text);

                    string SAP_Messsage = RFC_CAll(txt_Vendor.Text, txt_PO.Text, "", "", "", "", "", "", spn_invoice_no.InnerHtml, Convert.ToDateTime(spn_invoice_date.InnerHtml).ToString("yyyyMMdd"), Span_invoice_amount.InnerHtml, spn_delvr_note.InnerHtml, txt_Unique_ID.Text, "", Span_Remark.InnerHtml, spn_invoice_no.InnerHtml, Span_Location.InnerHtml, Convert.ToDateTime(Span_From.InnerHtml).ToString("yyyyMMdd"), Convert.ToDateTime(Span_To.InnerHtml).ToString("yyyyMMdd"), txt_Username.Text, spn_vendor_code.InnerHtml, txt_dtl_rfc.Text);
                    if (SAP_Messsage != "")
                    {
                        string[] array_msg = new string[2];
                        array_msg = SAP_Messsage.Split('$');
                        if (array_msg[0] == "S")
                        {
                            txt_Condition.Text = "1";
                            string isSaved = (string)ActionController.ExecuteAction("", "Service_PO_Approval.aspx", "update", ref ref_data, Convert.ToInt32(txt_Condition.Text), txtProcessID.Text, txtInstanceID.Text, txt_Audit.Text, txt_Username.Text, remark, ddlAction.SelectedItem.Text, txtApproverEmail.Text, Init_Email.Text);
                            if (isSaved == null || ref_data.Length > 0 || isSaved == "false")
                            {
                                divIns.Style["display"] = "none";
                                string[] errmsg = ref_data.Split(':');
                                Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('" + errmsg[0].ToString() + "');}</script>");
                            }
                            else
                            {
                                string[] Dval = new string[1];
                                Dval[0] = "";
                                string ref_data1  = string.Empty;
                                string release_id = (string)ActionController.ExecuteAction("", "Service_PO_Request.aspx", "getreleaseid", ref ref_data1, txtProcessID.Text, step_name.Text, "APPROVE");
                                if (release_id != "")
                                {
                                    bool isCreate = (bool)WFE.Action.ReleaseStep(txtProcessID.Text, txtInstanceID.Text, release_id, step_name.Text, "APPROVE", txt_Username.Text, txt_Username.Text.Trim(), "", "", "", "", "", "", "", "", "", "", Dval, txt_Request.Text, txtWIID.Text, ref isInserted);

                                    if (isCreate)
                                    {
                                        try
                                        {
                                            //msg = "<pre><font size='3'>Dear Sir/Madam,</font></pre><p/> <pre><font size='3'>Service PO has been Approved.</font></pre><p/> <pre><font size='3'>Request No: " + spn_req_no.InnerHtml + "</font></pre> <pre><font size='3'>Created By: " + txt_Initiator.Text.Trim() + "</font></pre></p><pre></b><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><br/><pre>Regards</pre><pre><b>Reporting Admin<b></pre><br/><pre></pre><br/><pre><font size='3'  color='red'><i><b>This is a system generated message. We request you not to reply to this message.</b></i></font></pre>";
                                            //emailid = (string)ActionController.ExecuteAction(txt_Username.Text, "Service_PO_Request.aspx", "insetmaildata", ref isInserted, txtProcessID.Text, txtInstanceID.Text, 0, "SERVICE PO APPROVAL", "APPROVE", txtApproverEmail.Text, Init_Email.Text, msg, "Request No: " + spn_req_no.InnerHtml);
                                        }
                                        catch (Exception)
                                        {
                                            throw;
                                        }
                                        finally
                                        {
                                            Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Service PO has been Approved.!');window.open('../../Portal/SCIL/Home.aspx','frmset_WorkArea');}</script>");
                                        }
                                    }
                                }
                                else
                                {
                                    divIns.Style["display"] = "none";
                                    Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Release Step Not Found ...!');window.open('../../Portal/SCIL/TaskDetails.aspx','frmset_WorkArea');}</script>");
                                }
                            }
                        }
                        else
                        {
                            Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('" + array_msg[1].ToString() + "');window.open('../../Portal/HomePage.aspx','frmset_WorkArea');}</script>");
                        }
                    }
                }
                else if (ddlAction.SelectedItem.Text == "Reject")
                {
                    txt_Condition.Text = "2";
                    txt_Audit.Text     = "SERVICE PO APPROVAL";
                    string isSaved = (string)ActionController.ExecuteAction("", "Service_PO_Approval.aspx", "update", ref ref_data, Convert.ToInt32(txt_Condition.Text), txtProcessID.Text, txtInstanceID.Text, txt_Audit.Text, txt_Username.Text, remark, ddlAction.SelectedItem.Text, Init_Email.Text, txtEmailID.Text);
                    if (isSaved == null || ref_data.Length > 0 || isSaved == "false")
                    {
                        divIns.Style["display"] = "none";
                        string[] errmsg = ref_data.Split(':');
                        Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('" + errmsg[0].ToString() + "');}</script>");
                    }
                    else
                    {
                        string[] Dval = new string[1];
                        Dval[0] = txt_Username.Text;
                        string ref_data1  = string.Empty;
                        string release_id = (string)ActionController.ExecuteAction("", "Service_PO_Request.aspx", "getreleaseid", ref ref_data1, txtProcessID.Text, step_name.Text, "REJECT");
                        if (release_id != "")
                        {
                            bool isCreate = (bool)WFE.Action.ReleaseStep(txtProcessID.Text, txtInstanceID.Text, release_id, step_name.Text, "REJECT", txt_Username.Text, txt_Username.Text.Trim(), "", "", "", "", "", "", "", "", "", "", Dval, txt_Request.Text, txtWIID.Text, ref isInserted);
                            if (isCreate)
                            {
                                try
                                {
                                    //string msg = "<pre><font size='3'>Dear Sir/Madam,</font></pre><p/> <pre><font size='3'>Service PO has been Rejected.</font></pre><p/> <pre><font size='3'>Request No: " + spn_req_no.InnerHtml + "</font></pre> <pre><font size='3'>Created By: " + txt_Initiator.Text.Trim() + "</font></pre></p><pre></b><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><br/><pre>Regards</pre><pre><b>Reporting Admin<b></pre><br/><pre></pre><br/><pre><font size='3'  color='red'><i><b>This is a system generated message. We request you not to reply to this message.</b></i></font></pre>";

                                    // string emailid = (string)ActionController.ExecuteAction(txt_Username.Text, "Service_PO_Request.aspx", "insetmaildata", ref isInserted, txtProcessID.Text, txtInstanceID.Text, 0, "FOREIGN ADVANCE REQUEST APPROVAL", "REJECT", Init_Email.Text, txtEmailID.Text, msg, "Request No: " + spn_req_no.InnerHtml);
                                }
                                catch (Exception)
                                {
                                    throw;
                                }
                                finally
                                {
                                    Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Service PO has been Rejected.');window.open('../../Portal/SCIL/Home.aspx','frmset_WorkArea');}</script>");
                                }
                            }
                        }
                        else
                        {
                            divIns.Style["display"] = "none";
                            Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Release Step Not Found ...!');window.open('../../Portal/SCIL/TaskDetails.aspx','frmset_WorkArea');}</script>");
                        }
                    }
                }
                else if (ddlAction.SelectedItem.Text == "Send-Back")
                {
                    txt_Condition.Text = "3";
                    txt_Audit.Text     = "SERVICE PO APPROVAL";
                    string isSaved = (string)ActionController.ExecuteAction("", "Service_PO_Approval.aspx", "update", ref ref_data, Convert.ToInt32(txt_Condition.Text), txtProcessID.Text, txtInstanceID.Text, txt_Audit.Text, txt_Username.Text, remark, ddlAction.SelectedItem.Text);
                    if (isSaved == null || ref_data.Length > 0 || isSaved == "false")
                    {
                        divIns.Style["display"] = "none";
                        string[] errmsg = ref_data.Split(':');
                        Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('" + errmsg[0].ToString() + "');}</script>");
                    }
                    else
                    {
                        string[] Dval = new string[1];
                        Dval[0] = txt_Initiator.Text;
                        string ref_data1  = string.Empty;
                        string release_id = (string)ActionController.ExecuteAction("", "Service_PO_Request.aspx", "getreleaseid", ref ref_data1, txtProcessID.Text, step_name.Text, "SEND-BACK");
                        if (release_id != "")
                        {
                            bool isCreate = (bool)WFE.Action.ReleaseStep(txtProcessID.Text, txtInstanceID.Text, release_id, step_name.Text, "SEND-BACK", txt_Username.Text, txt_Approver.Text.Trim(), "", "", "", "", "", "", "", "", "", "", Dval, txt_Request.Text, txtWIID.Text, ref isInserted);
                            if (isCreate)
                            {
                                try
                                {
                                    string msg = "<pre><font size='3'>Dear Sir/Madam,</font></pre><p/> <pre><font size='3'>Foreign Advance Request has been Sent back to the initiator.</font></pre><p/> <pre><font size='3'>Request No: " + spn_req_no.InnerHtml + "</font></pre> <pre><font size='3'>Created By: " + txt_Initiator.Text.Trim() + "</font></pre></p><pre></b><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><br/><pre>Regards</pre><pre><b>Reporting Admin<b></pre><br/><pre></pre><br/><pre><font size='3'  color='red'><i><b>This is a system generated message. We request you not to reply to this message.</b></i></font></pre>";

                                    string emailid = (string)ActionController.ExecuteAction(txt_Username.Text, "Service_PO_Request.aspx", "insetmaildata", ref isInserted, txtProcessID.Text, txtInstanceID.Text, 0, "SERVICE PO APPROVAL", "SEND-BACK", Init_Email.Text, txtEmailID.Text, msg, "Request No: " + spn_req_no.InnerHtml);
                                }
                                catch (Exception)
                                {
                                    throw;
                                }
                                finally
                                {
                                    Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Service PO has been Sent back to the initiator...!');window.open('../../Portal/SCIL/Home.aspx','frmset_WorkArea');}</script>");
                                }
                            }
                        }
                        else
                        {
                            divIns.Style["display"] = "none";
                            Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Release Step Not Found ...!');window.open('../../Portal/SCIL/TaskDetails.aspx','frmset_WorkArea');}</script>");
                        }
                    }
                }
            }
        }
        catch (Exception ex)
        {
            FSL.Logging.Logger.WriteEventLog(false, ex);
        }
    }
    public string bindReport(string cdate, int number)
    {
        string        strData = string.Empty;
        string        data    = string.Empty;
        StringBuilder html    = new StringBuilder();

        if (number == 1)
        {
            string username = Convert.ToString(Session["USER_ADID"]);
            html.Append("<table class='table table-bordered table-hover' >");
            html.Append("<thead><tr class='grey center'><th>#</th><th>Vendor Code</th><th>PO Number</th><th>PO Date</th><th>PO Value</th><th>Gross Value</th><th>Acknowlegde Date</th></tr></thead>");
            html.Append("<tbody>");
            DataTable dtData = (DataTable)ActionController.ExecuteAction("", "Vendor_Usage_Report.aspx", "getacknowdata", ref data, cdate, 1);

            if (dtData != null)
            {
                for (int i = 0; i < dtData.Rows.Count; i++)
                {
                    CryptoGraphy crypt       = new CryptoGraphy();
                    string       encrypt_Str = crypt.Encryptdata(Convert.ToString(dtData.Rows[i]["PO_NUMBER"]));
                    html.Append("<tr>");
                    html.Append("<td>" + (i + 1) + "</td>");
                    html.Append("<td>" + Convert.ToString(dtData.Rows[i]["VENDOR_CODE"]) + "</td>");
                    html.Append("<td><a href='#' role='button' id='anc" + (i + 1) + "' onclick='viewData(" + (i + 1) + ")'>" + Convert.ToString(dtData.Rows[i]["PO_NUMBER"]) + "</a><input type='text' id='encrypt_po" + (i + 1) + "' value=" + encrypt_Str + " style='display:none'></td>");
                    html.Append("<td>" + Convert.ToString(dtData.Rows[i]["PO_Date"]) + "</td>");
                    html.Append("<td align='right'>" + Convert.ToString(dtData.Rows[i]["PO_VALUE"]) + "</td>");
                    html.Append("<td align='right'>" + Convert.ToString(dtData.Rows[i]["PO_GV"]) + "</td>");
                    html.Append("<td>" + Convert.ToString(dtData.Rows[i]["ack_Date"]) + "</td>");
                    html.Append("</tr>");
                }
            }

            html.Append("</tbody>");
            html.Append("</table>");
        }
        else if (number == 2)
        {
            string username = Convert.ToString(Session["USER_ADID"]);
            html.Append("<table class='table table-bordered table-hover' >");
            html.Append("<thead><tr class='grey center'><th>#</th><th>Vendor Code</th><th>PO Number</th><th>Unique No</th><th>Date</th></tr></thead>");
            html.Append("<tbody>");
            DataTable dtData = (DataTable)ActionController.ExecuteAction("", "Vendor_Usage_Report.aspx", "getacknowdata", ref data, cdate, 2);
            if (dtData != null)
            {
                for (int i = 0; i < dtData.Rows.Count; i++)
                {
                    CryptoGraphy crypt       = new CryptoGraphy();
                    string       encrypt_Str = crypt.Encryptdata(Convert.ToString(dtData.Rows[i]["PO_Number"]));
                    html.Append("<tr>");
                    html.Append("<td>" + (i + 1) + "</td>");
                    html.Append("<td>" + Convert.ToString(dtData.Rows[i]["Vendor_Code"]) + "</td>");
                    html.Append("<td><a href='#' role='button' id='anc" + (i + 1) + "' onclick='viewData(" + (i + 1) + ")'>" + Convert.ToString(dtData.Rows[i]["PO_Number"]) + "</a><input type='text' id='encrypt_po" + (i + 1) + "' value=" + encrypt_Str + " style='display:none'></td>");
                    html.Append("<td>" + Convert.ToString(dtData.Rows[i]["Unique_No"]) + "</td>");
                    html.Append("<td>" + Convert.ToString(dtData.Rows[i]["dis_Date"]) + "</td>");
                    html.Append("</tr>");
                }
            }
            html.Append("</tbody>");
            html.Append("</table>");
        }
        else if (number == 3)
        {
            string username = Convert.ToString(Session["USER_ADID"]);
            html.Append("<table class='table table-bordered table-hover' >");
            html.Append("<thead><tr class='grey center'><th>#</th><th>Vendor Code</th><th>Date</th></tr></thead>");
            html.Append("<tbody>");
            DataTable dtData = (DataTable)ActionController.ExecuteAction("", "Vendor_Usage_Report.aspx", "getacknowdata", ref data, cdate, 3);
            if (dtData != null)
            {
                for (int i = 0; i < dtData.Rows.Count; i++)
                {
                    html.Append("<tr>");
                    html.Append("<td>" + (i + 1) + "</td>");
                    html.Append("<td>" + Convert.ToString(dtData.Rows[i]["USER_ADID"]) + "</td>");
                    html.Append("<td>" + Convert.ToString(dtData.Rows[i]["login_Date"]) + "</td>");
                    html.Append("</tr>");
                }
            }
            html.Append("</tbody>");
            html.Append("</table>");
        }
        else if (number == 4)
        {
            string username = Convert.ToString(Session["USER_ADID"]);
            html.Append("<table class='table table-bordered table-hover' >");
            html.Append("<thead><tr class='grey center'><th>#</th><th>Vendor Code</th><th>Vendor Name</th></tr></thead>");
            html.Append("<tbody>");
            DataTable dtData = (DataTable)ActionController.ExecuteAction("", "Vendor_Usage_Report.aspx", "getacknowdata", ref data, "", 4);
            if (dtData != null)
            {
                for (int i = 0; i < dtData.Rows.Count; i++)
                {
                    html.Append("<tr>");
                    html.Append("<td>" + (i + 1) + "</td>");
                    html.Append("<td>" + Convert.ToString(dtData.Rows[i]["Vendor_Code"]) + "</td>");
                    html.Append("<td>" + Convert.ToString(dtData.Rows[i]["Vendor_Name"]) + "</td>");
                    html.Append("</tr>");
                }
            }
            html.Append("</tbody>");
            html.Append("</table>");
        }
        else if (number == 5)
        {
            string username = Convert.ToString(Session["USER_ADID"]);
            html.Append("<table class='table table-bordered table-hover' >");
            html.Append("<thead><tr class='grey center'><th>#</th><th>Vendor Code</th><th>Vendor Name</th></tr></thead>");
            html.Append("<tbody>");
            DataTable dtData = (DataTable)ActionController.ExecuteAction("", "Vendor_Usage_Report.aspx", "getacknowdata", ref data, "", 5);
            if (dtData != null)
            {
                for (int i = 0; i < dtData.Rows.Count; i++)
                {
                    html.Append("<tr>");
                    html.Append("<td>" + (i + 1) + "</td>");
                    html.Append("<td>" + Convert.ToString(dtData.Rows[i]["Vendor_Code"]) + "</td>");
                    html.Append("<td>" + Convert.ToString(dtData.Rows[i]["Vendor_Name"]) + "</td>");
                    html.Append("</tr>");
                }
            }
            html.Append("</tbody>");
            html.Append("</table>");
        }
        strData = Convert.ToString(html);
        return(strData);
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string isSaved = string.Empty;

        try
        {
            ActionController.DisablePageCaching(this);
            if (ActionController.IsSessionExpired(this))
            {
                ActionController.RedirctToLogin(this);
            }
            else
            {
                divIns.Style.Add("display", "none");
                string isdata     = string.Empty;
                string isInserted = string.Empty;


                string xml_string = txt_xml_data.Text;
                xml_string        = xml_string.Replace("&", "&amp;");
                xml_string        = xml_string.Replace("'", "&apos;");
                txt_xml_data.Text = xml_string.ToString();

                string file_attach = txt_Document_Xml.Text;
                file_attach           = file_attach.Replace("&", "&amp;");
                file_attach           = file_attach.Replace("'", "&apos;");
                txt_Document_Xml.Text = file_attach.ToString();

                string adv_loc = "0";
                if (ddl_Payment_Mode.SelectedItem.Text.ToUpper().Trim() == "CASH")
                {
                    adv_loc = ddlAdv_Location.SelectedValue;
                }
                if (Convert.ToInt32(empno.InnerHtml) != 4262 && Convert.ToInt32(empno.InnerHtml) != 4263)
                {
                    isSaved = (string)ActionController.ExecuteAction("", "Other_Expenses_Request.aspx", "insert", ref isdata, spn_req_no.InnerHtml, txt_Username.Text, adv_loc, ddl_Payment_Mode.SelectedValue, req_remark.Text, xml_string, file_attach, txtProcessID.Text, txtInstanceID.Text, span_Approver.InnerHtml, 2, txt_advance_id.Text);
                    if (isSaved == null || isdata.Length > 0 || isSaved == "false")
                    {
                        string[] errmsg = isdata.Split(':');
                        Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('" + errmsg[0].ToString() + "');}</script>");
                    }
                    else
                    {
                        string[] Dval = new string[1];
                        Dval[0] = span_Approver.InnerHtml;
                        bool isCreate = (bool)WFE.Action.ReleaseStep(txtProcessID.Text, txtInstanceID.Text, "192", "OTHER EXPENSE MODIFICATION", "SUBMIT", txt_Username.Text, txt_Username.Text.Trim(), "", "", "", "", "", "", "", "", "", "", Dval, Convert.ToString(spn_req_no.InnerHtml), txtWIID.Text, ref isInserted);
                        if (isCreate)
                        {
                            try
                            {
                                string auditid = (string)ActionController.ExecuteAction(txt_Username.Text, "Other_Expenses_Request.aspx", "insertaudittrail", ref isInserted, txtProcessID.Text, txtInstanceID.Text, "OTHER EXPENSE MODIFICATION", "USER", txt_Username.Text, "SUBMIT", req_remark.Text, "0", "0");
                                string emailid = string.Empty;
                                string msg     = "<pre><font size='3'>Dear Sir/Madam,</font></pre><pre><font size='3'>Other Expense Request Has Been Modified Successfully and Sent For Approval.</font></pre><pre><font size='3'>Request No: " + spn_req_no.InnerHtml + "</font></pre><pre><font size='3'>Created By: " + span_ename.InnerHtml.Trim() + "</font></pre><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><pre></pre><pre><font size='3'  color='red'><i><b>This is a system generated message. We request you not to reply to this message.</b></i></font></pre>";
                                emailid = (string)ActionController.ExecuteAction(txt_Username.Text, "Other_Expenses_Request.aspx", "insetmaildata", ref isInserted, txtProcessID.Text, txtInstanceID.Text, 0, "OTHER EXPENSE MODIFICATION", "SUBMIT", txt_Approver_Email.Text, txtEmailID.Text, msg, "Request No: " + spn_req_no.InnerHtml);
                            }
                            catch (Exception ex)
                            {
                                // throw;
                                FSL.Logging.Logger.WriteEventLog(false, ex);
                            }
                            finally
                            {
                                // divIns.InnerHtml = "";
                                Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Other Expense Request Has Been Modified Successfully and Request No. is : " + spn_req_no.InnerHtml + " ...!');window.open('../../Portal/SCIL/Home.aspx','frmset_WorkArea');}</script>");
                            }
                        }
                        //Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Travel Request Applied Successfully...!');window.open('../../Portal/SCIL/Home.aspx','frmset_WorkArea');}</script>");
                    }
                }
                else
                {
                    /***************************************************************/
                    DataTable DTAP = new DataTable();
                    if (ddl_Payment_Mode.SelectedItem.Text.ToUpper() == "CASH")
                    {
                        DTAP = (DataTable)ActionController.ExecuteAction("", "Other_Expenses_Request_Approval.aspx", "getaccapprover", ref isdata, "OTHER EXPENSE PAYMENT APPROVAL", ddlAdv_Location.SelectedValue, ddl_Payment_Mode.SelectedValue);
                    }
                    else
                    {
                        DTAP = (DataTable)ActionController.ExecuteAction("", "Other_Expenses_Request_Approval.aspx", "getaccapprover", ref isdata, "OTHER EXPENSE PAYMENT APPROVAL", 0, ddl_Payment_Mode.SelectedValue);
                    }
                    if (DTAP != null)
                    {
                        if (DTAP.Rows.Count > 0)
                        {
                            isSaved = (string)ActionController.ExecuteAction("", "Other_Expenses_Request.aspx", "insert", ref isdata, spn_req_no.InnerHtml, txt_Username.Text, adv_loc, ddl_Payment_Mode.SelectedValue, req_remark.Text, xml_string, file_attach, txtProcessID.Text, txtInstanceID.Text, span_Approver.InnerHtml, 2, txt_advance_id.Text);
                            if (isSaved == null || isdata.Length > 0 || isSaved == "false")
                            {
                                string[] errmsg = isdata.Split(':');
                                Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('" + errmsg[0].ToString() + "');}</script>");
                            }
                            else
                            {
                                string[] Dval = new string[1];
                                Dval[0] = span_Approver.InnerHtml;
                                bool isCreate = (bool)WFE.Action.ReleaseStep(txtProcessID.Text, txtInstanceID.Text, "192", "OTHER EXPENSE MODIFICATION", "SUBMIT", txt_Username.Text, txt_Username.Text.Trim(), "", "", "", "", "", "", "", "", "", "", Dval, Convert.ToString(spn_req_no.InnerHtml), txtWIID.Text, ref isInserted);
                                if (isCreate)
                                {
                                    try
                                    {
                                        string   auditid = (string)ActionController.ExecuteAction(txt_Username.Text, "Other_Expenses_Request.aspx", "insertaudittrail", ref isInserted, txtProcessID.Text, txtInstanceID.Text, "OTHER EXPENSE MODIFICATION", "USER", txt_Username.Text, "SUBMIT", req_remark.Text, "0", "0");
                                        string   wiid    = (string)ActionController.ExecuteAction(txt_Username.Text, "Bulk_Travel_Expense_Doc_Verification.aspx", "getpktransid", ref isInserted, txtProcessID.Text, txtInstanceID.Text);
                                        string[] Dval1   = new string[DTAP.Rows.Count];
                                        if (DTAP.Rows.Count > 0)
                                        {
                                            for (int i = 0; i < DTAP.Rows.Count; i++)
                                            {
                                                Dval1[i] = Convert.ToString(DTAP.Rows[i]["USER_ADID"]);
                                                if (txt_Approver_Email.Text == "")
                                                {
                                                    txt_Approver_Email.Text = Convert.ToString(DTAP.Rows[i]["EMAIL_ID"]);
                                                }
                                                else
                                                {
                                                    txt_Approver_Email.Text = txt_Approver_Email.Text + ',' + Convert.ToString(DTAP.Rows[i]["EMAIL_ID"]);
                                                }
                                            }
                                        }
                                        isCreate = (bool)WFE.Action.ReleaseStep(txtProcessID.Text, txtInstanceID.Text, "189", "OTHER EXPENSE APPROVAL", "SUBMIT", txt_Username.Text, txt_Username.Text.Trim(), "", "", "", "", "", "", "", "", "", "", Dval1, spn_req_no.InnerHtml, wiid, ref isInserted);
                                        if (isCreate)
                                        {
                                            try
                                            {
                                                auditid = (string)ActionController.ExecuteAction(txt_Username.Text, "Other_Expenses_Request.aspx", "insertaudittrail", ref isInserted, txtProcessID.Text, txtInstanceID.Text, "OTHER EXPENSE APPROVAL", "USER", txt_Username.Text, "SUBMIT", "Approve", "0", "0");

                                                string       msg          = "";
                                                CryptoGraphy crypt        = new CryptoGraphy();
                                                string       process_name = crypt.Encryptdata("OTHER EXPENSES");
                                                string       req_no       = crypt.Encryptdata(spn_req_no.InnerHtml);
                                                if (ddl_Payment_Mode.SelectedItem.Text.ToUpper() == "CASH")
                                                {
                                                    msg = "<pre><span style='font-size: medium;'>Dear Sir/Madam,</span></pre><pre><span style='font-size: medium;'>Other Expense Request Has Been Modified Successfully and Sent For Payment Approval.</span></pre><pre><span style='font-size: medium;'>Request No: " + spn_req_no.InnerHtml + "</span></pre><pre><span style='font-size: medium;'>Created By: " + span_ename.InnerHtml.Trim() + "</span></pre><pre><span style='font-size: medium;'>Please Take Voucher Print By Link Given Below : </span></pre><pre><span style='font-size: medium;'>INTRANET URL:<a href='http://" + compname + "/Sudarshan-Portal/Vouchers/Cash_Voucher.aspx?P=" + process_name + "&R=" + req_no + "'>http://" + compname + "/Sudarshan-Portal/Vouchers/Cash_Voucher.aspx?P=" + process_name + "&R=" + req_no + "</a></span></pre><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><pre>&nbsp;</pre><pre><span style='color: red; font-size: medium;'><em><strong>Kindly attach all the original supporting documents with the voucher print & submit to the Cashier in case mode of payment requested is cash otherwise, send the documents to the Cashier at GHO Pune.</strong></em></span></pre>";
                                                }
                                                else
                                                {
                                                    msg = "<pre><span style='font-size: medium;'>Dear Sir/Madam,</span></pre><pre><span style='font-size: medium;'>Other Expense Request Has Been Modified Successfully and Sent For Payment Approval.</span></pre><pre><span style='font-size: medium;'>Request No: " + spn_req_no.InnerHtml + "</span></pre><pre><span style='font-size: medium;'>Created By: " + span_ename.InnerHtml.Trim() + "</span></pre><pre><span style='font-size: medium;'>Please Take Voucher Print By Link Given Below : </span></pre><pre><span style='font-size: medium;'>INTRANET URL:<a href='http://" + compname + "/Sudarshan-Portal/Vouchers/Bank_Voucher.aspx?P=" + process_name + "&R=" + req_no + "'>http://" + compname + "/Sudarshan-Portal/Vouchers/Bank_Voucher.aspx?P=" + process_name + "&R=" + req_no + "</a></span></pre><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><pre>&nbsp;</pre><pre><span style='color: red; font-size: medium;'><em><strong>Kindly attach all the original supporting documents with the voucher print & submit to the Cashier in case mode of payment requested is cash otherwise, send the documents to the Cashier at GHO Pune.</strong></em></span></pre>";
                                                }

                                                string emailid = (string)ActionController.ExecuteAction(txt_Username.Text, "Other_Expenses_Request.aspx", "insetmaildata", ref isInserted, txtProcessID.Text, txtInstanceID.Text, 0, "OTHER EXPENSE APPROVAL", "SUBMIT", txtEmailID.Text, txt_Approver_Email.Text, msg, "Request No: " + spn_req_no.InnerHtml);
                                            }
                                            catch (Exception)
                                            {
                                                throw;
                                            }
                                            finally
                                            {
                                                Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Other Expense Request Modified Successfully and Sent For Payment Process ...!');window.open('../../Portal/SCIL/Home.aspx','frmset_WorkArea');}</script>");
                                            }
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        // throw;
                                        FSL.Logging.Logger.WriteEventLog(false, ex);
                                    }
                                    finally
                                    {
                                        //divIns.InnerHtml = "";
                                    }
                                }
                            }
                        }
                        else
                        {
                            Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Account Payment Approver Not Available For Payment Mode : " + ddl_Payment_Mode.SelectedItem.Text + "  ...!');window.open('../../Portal/SCIL/TaskDetails.aspx','frmset_WorkArea');}</script>");
                        }
                    }
                    else
                    {
                        Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Account Payment Approver Not Available For Payment Mode : " + ddl_Payment_Mode.SelectedItem.Text + "  ...!');window.open('../../Portal/SCIL/TaskDetails.aspx','frmset_WorkArea');}</script>");
                    }
                    /***************************************************************/
                }
            }
        }
        catch (Exception Exc) { FSL.Logging.Logger.WriteEventLog(false, Exc); }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        string oauth_token    = Request.QueryString["oauth_token"];
        string oauth_verifier = Request.QueryString["oauth_verifier"];

        if (oauth_token != null && oauth_verifier != null)
        {
            Application["oauth_token"]    = oauth_token;
            Application["oauth_verifier"] = oauth_verifier;
            Response.Redirect("LinkedInAccountDetails.aspx?oauth_verifier=" + oauth_verifier + "");
        }
        //divSuccess.Visible = false;
        Label FailureText = (Label)Login1.FindControl("FailureText");

        FailureText.Visible = false;
        if (!IsPostBack)
        {
            //Label FailureText = (Label)Login1.FindControl("FailureText");
            FailureText.Visible = false;
            //divSuccess.Visible = false;
            if (Request.Browser.IsMobileDevice)
            {
                Session.Timeout = 100000;
            }
            else
            {
                //Session.Timeout = 1200;
                Session.Timeout = 86400;
            }

            if (Page.Session["LoginName"] != null)
            {
                //Response.Redirect("Home.aspx?ActiveStatus=P");
            }

            string login = "";
            try
            {
                login = Convert.ToString(Request.QueryString["Login"]);
            }
            catch
            {
                login = "";
            }
            if (Request.Cookies["myScrlCookie"] != null)
            {
                CryptoGraphy objdcryptt   = new CryptoGraphy();
                HttpCookie   myScrlCookie = new HttpCookie("myScrlCookie");
                myScrlCookie    = Request.Cookies.Get("myScrlCookie");
                Login1.UserName = myScrlCookie.Values["UserName"].ToString();
                TextBox txtbox = (TextBox)Login1.FindControl("Password");
                txtbox.Attributes["Value"] = myScrlCookie.Values["Password"].ToString();
                LoginUser();
            }
            else
            {
                TextBox txtboxPassword = (TextBox)Login1.FindControl("Password");
                TextBox txtboxUserName = (TextBox)Login1.FindControl("UserName");
                txtboxUserName.Text = string.Empty;
                txtboxPassword.Text = string.Empty;
            }
        }
    }
Beispiel #24
0
    protected string getUserData(string name, int pageno, int rpp)
    {
        string        strData = string.Empty;
        string        data    = string.Empty;
        StringBuilder html    = new StringBuilder();

        try
        {
            GetData getData  = new GetData();
            string  username = Convert.ToString(Session["USER_ADID"]);
            html.Append("<table class='table table-bordered table-hover' >");
            html.Append("<thead><tr class='grey center'><th>#</th><th>Material Code</th><th>Material Text</th><th>Vendor Name</th><th>Po No</th><th>Po Date</th><th>Quantity</th><th>Delivery Date</th></tr></thead>");
            html.Append("<tbody>");
            DataTable dtData = (DataTable)ActionController.ExecuteAction("", "Pending_Deliveries_Purchase.aspx", "getpendingdeliveries", ref data, username, name);
            if (dtData != null)
            {
                int ddl  = rpp;
                int from = (pageno - 1) * ddl;
                int to   = ((pageno - 1) * ddl) + ddl;
                for (int i = from; i < to; i++)
                {
                    if (i < dtData.Rows.Count)
                    {
                        CryptoGraphy crypt       = new CryptoGraphy();
                        string       encrypt_Str = crypt.Encryptdata(Convert.ToString(dtData.Rows[i]["Po_no"]));
                        html.Append("<tr>");
                        html.Append("<td>" + (i + 1) + "</td>");
                        html.Append("<td>" + Convert.ToString(dtData.Rows[i]["material_code"]) + "</td>");
                        html.Append("<td>" + Convert.ToString(dtData.Rows[i]["material_desc"]) + "</td>");
                        html.Append("<td>" + Convert.ToString(dtData.Rows[i]["vendor_name"]) + "</td>");
                        html.Append("<td><a href='#' role='button' id='anc" + (i + 1) + "' onclick='viewData(" + (i + 1) + ")'>" + Convert.ToString(dtData.Rows[i]["Po_no"]) + "</a><input type='text' id='encrypt_po" + (i + 1) + "' value=" + encrypt_Str + " style='display:none'></td>");
                        html.Append("<td>" + Convert.ToString(dtData.Rows[i]["po_date"]) + "</td>");
                        html.Append("<td align='center'>" + Convert.ToString(dtData.Rows[i]["Quantity"]) + "</td>");
                        html.Append("<td align='center'>" + Convert.ToString(dtData.Rows[i]["delivery_date"]) + "</td>");
                        html.Append("</tr>");
                    }
                }
            }

            html.Append("</tbody>");
            html.Append("</table>");

            double cnt = Convert.ToDouble(dtData.Rows.Count) / rpp;
            if (cnt > Convert.ToInt16(Convert.ToInt32(dtData.Rows.Count) / rpp))
            {
                cnt = (int)cnt + 1;
            }

            if (cnt > 1)
            {
                html.Append("<div class='dataTables_paginate paging_simple_numbers' style='text-align:center'>");
                html.Append("<ul class='pagination'>");
                for (int j = 1; j <= cnt; j++)
                {
                    if (j == pageno)
                    {
                        html.Append("<li class='paginate_button' style='margin:2px;'><input type='button' value='" + j + "' class='btn btn-inverse' style=' font-weight:normal' onclick='gotopage(this," + rpp + ")'></li>");
                    }
                    else
                    {
                        html.Append("<li class='paginate_button' style='margin:2px;'><input type='button' value='" + j + "' class='btn btn-default buttons-copy buttons-flash' style=' font-weight:normal' onclick='gotopage(this," + rpp + ")'></li>");
                    }
                }
                html.Append("</ul></div>");
            }
            strData = Convert.ToString(html);
        }
        catch (Exception ex)
        {
        }
        return(strData);
    }
    protected string getUserData(string name, int pageno, int rpp)
    {
        string        strData = string.Empty;
        string        data    = string.Empty;
        StringBuilder html    = new StringBuilder();

        try
        {
            GetData getData  = new GetData();
            string  username = Convert.ToString(Session["USER_ADID"]);
            html.Append("<table class='table table-bordered table-hover' >");
            html.Append("<thead><tr class='grey center'><th>#</th><th>Vendor Code</th><th>Vendor Name</th><th>Material Code</th><th>Material Text</th><th>Po No</th><th>Po Date</th><th>Quantity</th><th>Dispatch Date</th><th>LR No</th><th>LR Date</th><th>Transporter</th><th>Invoice No</th><th>Invoice Date</th></tr></thead>");
            html.Append("<tbody>");
            DataTable dtData = (DataTable)ActionController.ExecuteAction("", "Material_Transit_Report.aspx", "getmaterialreport", ref data, username, name);
            if (dtData != null)
            {
                int ddl  = rpp;
                int from = (pageno - 1) * ddl;
                int to   = ((pageno - 1) * ddl) + ddl;
                for (int i = from; i < to; i++)
                {
                    if (i < dtData.Rows.Count)
                    {
                        CryptoGraphy crypt       = new CryptoGraphy();
                        string       encrypt_Str = crypt.Encryptdata(Convert.ToString(dtData.Rows[i]["PO_Number"]));
                        //html.Append("<tr><td><a href='#vendorinfo' role='button' data-toggle='modal' id='veninfo" + (i + 1) + "' onclick='viewVendor(" + (i + 1) + ")' >" + Convert.ToString(dtData.Rows[i]["vendor_name"]) + "</a></td><td><a href='#' role='button' id='anc" + (i + 1) + "' onclick='viewData(" + (i + 1) + ")'>" + Convert.ToString(dtData.Rows[i]["PO_Number"]) + "</a></td><td style='text-align: right;'>" + Convert.ToString(dtData.Rows[i]["PO_GV"]) + "</td><td>" + Convert.ToString(dtData.Rows[i]["Plant"]) + "</td><td>" + Convert.ToString(dtData.Rows[i]["Unique_No"]) + "</td><td><a href='#paymentterm' role='button' data-toggle='modal' onclick='setSelectedNote(" + Convert.ToString(dtData.Rows[i]["PK_Dispatch_Note_ID"]) + ")'>" + Convert.ToString(dtData.Rows[i]["request_id"]) + "</a></td><td>" + Convert.ToString(dtData.Rows[i]["Invoice_No"]) + "</td><td style='text-align: right;'>" + Convert.ToString(dtData.Rows[i]["Invoice_Amount"]) + "</td><td>" + Convert.ToString(dtData.Rows[i]["Dispatch_Quantity"]) + "</td><td style='text-align: right; display:none'><input type='text' id='encrypt_po" + (i + 1) + "' value=" + encrypt_Str + " style='display:none'><input type='text' id='venCode" + (i + 1) + "' value=" + Convert.ToString(dtData.Rows[i]["vendor_code"]) + " style='display:none'></td></tr>");
                        html.Append("<tr>");
                        html.Append("<td>" + (i + 1) + "</td>");
                        html.Append("<td>" + Convert.ToString(dtData.Rows[i]["vendor_code"]) + "</td>");
                        html.Append("<td>" + Convert.ToString(dtData.Rows[i]["vendor_name"]) + "</td>");
                        html.Append("<td>" + Convert.ToString(dtData.Rows[i]["material_no"]) + "</td>");
                        html.Append("<td>" + Convert.ToString(dtData.Rows[i]["material_desc"]) + "</td>");
                        html.Append("<td><a href='#' role='button' id='anc" + (i + 1) + "' onclick='viewData(" + (i + 1) + ")'>" + Convert.ToString(dtData.Rows[i]["PO_Number"]) + "</a><input type='text' id='encrypt_po" + (i + 1) + "' value=" + encrypt_Str + " style='display:none'></td>");
                        html.Append("<td>" + Convert.ToString(dtData.Rows[i]["po_date"]) + "</td>");
                        html.Append("<td align='center'>" + Convert.ToString(dtData.Rows[i]["dispatch_quantity"]) + "</td>");
                        html.Append("<td>" + Convert.ToString(dtData.Rows[i]["dispatch_date"]) + "</td>");
                        html.Append("<td>" + Convert.ToString(dtData.Rows[i]["lr_no"]) + "</td>");
                        html.Append("<td>" + Convert.ToString(dtData.Rows[i]["lr_date"]) + "</td>");
                        html.Append("<td>" + Convert.ToString(dtData.Rows[i]["transporter_name"]) + "</td>");
                        html.Append("<td>" + Convert.ToString(dtData.Rows[i]["invoice_no"]) + "</td>");
                        html.Append("<td>" + Convert.ToString(dtData.Rows[i]["invoice_date"]) + "</td>");
                        html.Append("</tr>");
                    }
                }
            }

            html.Append("</tbody>");
            html.Append("</table>");

            double cnt = Convert.ToDouble(dtData.Rows.Count) / rpp;
            if (cnt > Convert.ToInt16(Convert.ToInt32(dtData.Rows.Count) / rpp))
            {
                cnt = (int)cnt + 1;
            }

            if (cnt > 1)
            {
                html.Append("<div class='dataTables_paginate paging_simple_numbers' style='text-align:center'>");
                html.Append("<ul class='pagination'>");
                for (int j = 1; j <= cnt; j++)
                {
                    html.Append("<li class='paginate_button' style='margin:2px;'><input type='button' value='" + j + "' class='btn btn-default buttons-copy buttons-flash' style=' font-weight:normal' onclick='gotopage(this," + rpp + ")'></li>");
                }
                html.Append("</ul></div>");
            }
            strData = Convert.ToString(html);
        }
        catch (Exception ex)
        {
        }
        return(strData);
    }
Beispiel #26
0
    protected void lnlNext_Click(object sender, EventArgs e)
    {
        CompareValidator1.Validate();
        lblMsgs.Text = "";

        dt = new DataTable();
        dt = (DataTable)ViewState["UserDetails"];
        if (txtUname.Text.Trim().Replace("'", "''") == "")
        {
            return;
        }
        if (txtFirstName.Text.Trim().Replace("'", "''") == "" || txtFirstName.Text.Trim().Replace("'", "''") == "First Name")
        {
            lblMsgs.Text = "First name is required.";
            return;
        }
        if (txtLastName.Text.Trim().Replace("'", "''") == "" || txtLastName.Text.Trim().Replace("'", "''") == "Last Name")
        {
            lblMsgs.Text = "Last name is required.";
            return;
        }

        if (txtPassword.Text.Trim() == "")
        {
            return;
        }
        if (txtConPassword.Text.Trim() == "")
        {
            lblMsgs.Text = "Confirm password is required.";
            return;
        }
        if (chkIAgree.Checked == false)
        {
            lblMsgs.Text = "Please check Terms & Conditions.";
            return;
        }

        if (txtConPassword.Text.Trim() != txtPassword.Text.Trim())
        {
            lblMsgs.Text = "Passwords do not match.";
            return;
        }

        objLogin.Username = txtUname.Text.Trim().Replace("'", "''");
        dt = objLoginDB.GetDataSet(objLogin, DA_SKORKEL.DA_Login.Login_1.GmailFBLogin);
        if (dt.Rows.Count > 0)
        {
            lblMsgs.Text  = "Email id already exist.";
            txtUname.Text = "";
            return;
        }

        CryptoGraphy objEncrypt = new CryptoGraphy();
        string       Password   = objEncrypt.Encrypt(txtPassword.Text.Trim());
        string       middleName = "";

        BindDataTable();
        row = dt.NewRow();
        //Defect #9 Validate HTML Input
        row["FirstName"]   = Validations.validateHtmlInput(txtFirstName.Text.Trim());
        row["MiddleName"]  = middleName;
        row["LastName"]    = Validations.validateHtmlInput(txtLastName.Text.Trim());
        row["UserName"]    = txtUname.Text.Trim();
        row["Password"]    = Password;
        row["ConPassword"] = txtConPassword.Text.Trim();
        row["UserTypeId"]  = 1;                    //  For students
        dt.Rows.Add(row);
        Session.Add("UserDetails", dt);
        Response.Redirect("~/SignUp2.aspx");
    }
    protected void btnRequest_Click(object sender, EventArgs e)
    {
        try
        {
            ActionController.DisablePageCaching(this);
            if (ActionController.IsSessionExpired(this))
            {
                ActionController.RedirctToLogin(this);
            }
            else
            {
                string remark = txtRemark.Value;



                string isInserted = string.Empty;
                string ref_data   = string.Empty;
                txt_Audit.Text = "FOREIGN ADVANCE REQUEST APPROVAL";
                if (ddlAction.SelectedItem.Text == "Approve")
                {
                    DataTable    DTAP         = new DataTable();
                    string       msg          = "";
                    string       emailid      = string.Empty;
                    CryptoGraphy crypt        = new CryptoGraphy();
                    string       req_no       = crypt.Encryptdata(txt_Request.Text);
                    string       process_name = crypt.Encryptdata("ADVANCE EXPENSE");
                    // txt_Deviate.Text = "1";
                    if (txt_Deviate.Text != "1")
                    {
                        DTAP = (DataTable)ActionController.ExecuteAction("", "Advance_Request_Approval_Foreign.aspx", "getaccapprover", ref ref_data, "ADVANCE REQUEST FOREIGN ACCOUNT PAYABLE APPROVAL", 0, txt_paymode.Text);

                        if (DTAP != null)
                        {
                            if (DTAP.Rows.Count > 0)
                            {
                                txt_Condition.Text = "3";
                                string isSaved = (string)ActionController.ExecuteAction("", "Advance_Request_Approval_Foreign.aspx", "update", ref ref_data, Convert.ToInt32(txt_Condition.Text), txtProcessID.Text, txtInstanceID.Text, txt_Audit.Text, txt_Username.Text, remark, ddlAction.SelectedItem.Text);
                                if (isSaved == null || ref_data.Length > 0 || isSaved == "false")
                                {
                                    string[] errmsg = ref_data.Split(':');
                                    Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('" + errmsg[0].ToString() + "');}</script>");
                                }
                                else
                                {
                                    string[] Dval = new string[DTAP.Rows.Count];
                                    Dval[0] = "";
                                    if (DTAP.Rows.Count > 0)
                                    {
                                        for (int i = 0; i < DTAP.Rows.Count; i++)
                                        {
                                            Dval[i] = Convert.ToString(DTAP.Rows[i]["USER_ADID"]);
                                            if (txtApproverEmail.Text == "")
                                            {
                                                txtApproverEmail.Text = Convert.ToString(DTAP.Rows[i]["EMAIL_ID"]);
                                            }
                                            else
                                            {
                                                txtApproverEmail.Text = txtApproverEmail.Text + ',' + Convert.ToString(DTAP.Rows[i]["EMAIL_ID"]);
                                            }
                                        }
                                        string ref_data1  = string.Empty;
                                        string release_id = (string)ActionController.ExecuteAction("", "Advance_Request_Foreign.aspx", "getreleaseid", ref ref_data1, txtProcessID.Text, step_name.Text, "APPROVE");
                                        if (release_id != "")
                                        {
                                            bool isCreate = (bool)WFE.Action.ReleaseStep(txtProcessID.Text, txtInstanceID.Text, release_id, step_name.Text, "APPROVE", txt_Username.Text, txt_Username.Text.Trim(), "", "", "", "", "", "", "", "", "", "", Dval, txt_Request.Text, txtWIID.Text, ref isInserted);

                                            if (isCreate)
                                            {
                                                try
                                                {
                                                    msg     = "<pre><font size='3'>Dear Sir/Madam,</font></pre><p/> <pre><font size='3'>Foreign Advance Request has been sent to Accounts for payment approval.</font></pre><p/> <pre><font size='3'>Request No: " + spn_req_no.InnerHtml + "</font></pre> <pre><font size='3'>Created By: " + txt_Initiator.Text.Trim() + "</font></pre></p><pre></b><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><br/><pre>Regards</pre><pre><b>Reporting Admin<b></pre><br/><pre></pre><br/><pre><font size='3'  color='red'><i><b>This is a system generated message. We request you not to reply to this message.</b></i></font></pre>";
                                                    emailid = (string)ActionController.ExecuteAction(txt_Username.Text, "Advance_Request_Foreign.aspx", "insetmaildata", ref isInserted, txtProcessID.Text, txtInstanceID.Text, 0, "FOREIGN ADVANCE REQUEST APPROVAL", "APPROVE", txtApproverEmail.Text, Init_Email.Text, msg, "Request No: " + spn_req_no.InnerHtml);
                                                }
                                                catch (Exception)
                                                {
                                                    throw;
                                                }
                                                finally
                                                {
                                                    Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Foreign Advance Request has been sent for account payment approval.!');window.open('../../Portal/SCIL/Home.aspx','frmset_WorkArea');}</script>");
                                                }
                                            }
                                        }
                                        else
                                        {
                                            Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Release Step Not Found ...!');window.open('../../Portal/SCIL/TaskDetails.aspx','frmset_WorkArea');}</script>");
                                        }
                                    }
                                }
                            }
                            else
                            {
                                Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Accounts For Payment Approval Not Found.!');}</script>");
                            }
                        }
                    }
                    else
                    {
                        double z = 0;

                        z = Convert.ToDouble(txt_perdaysamt1.Text);


                        string[] dval = new string[0];

                        if (z > 300)
                        {
                            DataTable dtAF = (DataTable)ActionController.ExecuteAction("", "Advance_Request_Approval_Foreign.aspx", "getadvancedeviateforeign", ref isInserted, z);
                            if (dtAF != null && dtAF.Rows.Count > 0)
                            {
                                dval = new string[dtAF.Rows.Count];
                                for (int f = 0; f < dtAF.Rows.Count; f++)
                                {
                                    dval[f] = Convert.ToString(dtAF.Rows[f]["ad_id"]);
                                    txt_sameapprover.Text = Convert.ToString(dtAF.Rows[f]["ad_id"]);
                                    if (f == 0)
                                    {
                                        txtApproverEmail.Text = Convert.ToString(dtAF.Rows[f]["EMAIL_ID"]);
                                    }
                                    else
                                    {
                                        txtApproverEmail.Text += Convert.ToString(dtAF.Rows[f]["EMAIL_ID"]);
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (doa_user.Text != "" && doa_user.Text != "NA")
                            {
                                dval    = new string[1];
                                dval[0] = doa_user.Text;
                                txt_sameapprover.Text = doa_user.Text;
                                txtApproverEmail.Text = doa_email.Text;
                            }
                        }

                        if ((txt_Username.Text).ToLower() != (txt_sameapprover.Text).ToLower())  //next same approver
                        {
                            if (dval.Length > 0)
                            {
                                txt_Condition.Text = "3";
                                string isSaved = (string)ActionController.ExecuteAction("", "Advance_Request_Approval_Foreign.aspx", "update", ref ref_data, Convert.ToInt32(txt_Condition.Text), txtProcessID.Text, txtInstanceID.Text, txt_Audit.Text, txt_Username.Text, remark, ddlAction.SelectedItem.Text);
                                if (isSaved == null || ref_data.Length > 0 || isSaved == "false")
                                {
                                    string[] errmsg = ref_data.Split(':');
                                    Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('" + errmsg[0].ToString() + "');}</script>");
                                }
                                else
                                {
                                    string ref_data1  = string.Empty;
                                    string release_id = (string)ActionController.ExecuteAction("", "Advance_Request_Foreign.aspx", "getreleaseid", ref ref_data1, txtProcessID.Text, step_name.Text, "DOA-SUBMIT");
                                    if (release_id != "")
                                    {
                                        bool isCreate = (bool)WFE.Action.ReleaseStep(txtProcessID.Text, txtInstanceID.Text, release_id, step_name.Text, "DOA-SUBMIT", txt_Username.Text, txt_Username.Text.Trim(), "", "", "", "", "", "", "", "", "", "", dval, txt_Request.Text, txtWIID.Text, ref isInserted);
                                        if (isCreate)
                                        {
                                            try
                                            {
                                                msg     = "<pre><font size='3'>Dear Sir/Madam,</font></pre><p/> <pre><font size='3'>Foreign Advance Request Approved Successfully and sent for Deviation Approval.</font></pre><p/> <pre><font size='3'>Request No: " + spn_req_no.InnerHtml + "</font></pre> <pre><font size='3'>Created By: " + txt_Initiator.Text.Trim() + "</font></pre></p><pre></b><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><br/><pre>Regards</pre><pre><b>Reporting Admin<b></pre><br/><pre></pre><br/><pre><font size='3'  color='red'><i><b>This is a system generated message. We request you not to reply to this message.</b></i></font></pre>";
                                                emailid = (string)ActionController.ExecuteAction(txt_Username.Text, "Advance_Request_Foreign.aspx", "insetmaildata", ref isInserted, txtProcessID.Text, txtInstanceID.Text, 0, "FOREIGN ADVANCE REQUEST APPROVAL", "DOA-SUBMIT", txtApproverEmail.Text, Init_Email.Text, msg, "Request No: " + spn_req_no.InnerHtml);
                                            }
                                            catch (Exception)
                                            {
                                                throw;
                                            }
                                            finally
                                            {
                                                Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Foreign Advance Request has been Approved Successfully and Sent To Deviation Approval...!');window.open('../../Portal/SCIL/Home.aspx','frmset_WorkArea');}</script>");
                                            }
                                        }
                                    }
                                    else
                                    {
                                        Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Release Step Not Found ...!');window.open('../../Portal/SCIL/TaskDetails.aspx','frmset_WorkArea');}</script>");
                                    }
                                }
                            }
                            else
                            {
                                Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Deviation Approver Not Found...!');}</script>");
                            }
                        }
                        else
                        {
                            DTAP = (DataTable)ActionController.ExecuteAction("", "Advance_Request_Approval_Foreign.aspx", "getaccapprover", ref ref_data, "ADVANCE REQUEST FOREIGN ACCOUNT PAYABLE APPROVAL", 0, txt_paymode.Text);

                            if (DTAP != null)
                            {
                                if (DTAP.Rows.Count > 0)
                                {
                                    txt_Condition.Text = "3";
                                    string isSaved = (string)ActionController.ExecuteAction("", "Advance_Request_Approval_Foreign.aspx", "update", ref ref_data, Convert.ToInt32(txt_Condition.Text), txtProcessID.Text, txtInstanceID.Text, txt_Audit.Text, txt_Username.Text, remark, ddlAction.SelectedItem.Text);


                                    if (isSaved == null || ref_data.Length > 0 || isSaved == "false")
                                    {
                                        string[] errmsg = ref_data.Split(':');
                                        Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('" + errmsg[0].ToString() + "');}</script>");
                                    }
                                    else
                                    {
                                        ref_data = string.Empty;
                                        string isSaved1 = (string)ActionController.ExecuteAction("", "Advance_Request_Approval_Foreign.aspx", "updatesameappr", ref ref_data, txtProcessID.Text, txtInstanceID.Text, txt_Audit.Text, txt_Username.Text, remark, ddlAction.SelectedItem.Text, txt_Request.Text);

                                        string[] Dval = new string[DTAP.Rows.Count];
                                        Dval[0] = "";
                                        if (DTAP.Rows.Count > 0)
                                        {
                                            for (int i = 0; i < DTAP.Rows.Count; i++)
                                            {
                                                Dval[i] = Convert.ToString(DTAP.Rows[i]["USER_ADID"]);
                                                if (txtApproverEmail.Text == "")
                                                {
                                                    txtApproverEmail.Text = Convert.ToString(DTAP.Rows[i]["EMAIL_ID"]);
                                                }
                                                else
                                                {
                                                    txtApproverEmail.Text = txtApproverEmail.Text + ',' + Convert.ToString(DTAP.Rows[i]["EMAIL_ID"]);
                                                }
                                            }
                                            string ref_data1  = string.Empty;
                                            string release_id = (string)ActionController.ExecuteAction("", "Advance_Request_Foreign.aspx", "getreleaseid", ref ref_data1, txtProcessID.Text, step_name.Text, "APPROVE");
                                            if (release_id != "")
                                            {
                                                bool isCreate = (bool)WFE.Action.ReleaseStep(txtProcessID.Text, txtInstanceID.Text, release_id, step_name.Text, "APPROVE", txt_Username.Text, txt_Username.Text.Trim(), "", "", "", "", "", "", "", "", "", "", Dval, txt_Request.Text, txtWIID.Text, ref isInserted);

                                                if (isCreate)
                                                {
                                                    try
                                                    {
                                                        msg     = "<pre><font size='3'>Dear Sir/Madam,</font></pre><p/> <pre><font size='3'>Foreign Advance Request has been sent to Accounts for payment approval.</font></pre><p/> <pre><font size='3'>Request No: " + spn_req_no.InnerHtml + "</font></pre> <pre><font size='3'>Created By: " + txt_Initiator.Text.Trim() + "</font></pre></p><pre></b><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><br/><pre>Regards</pre><pre><b>Reporting Admin<b></pre><br/><pre></pre><br/><pre><font size='3'  color='red'><i><b>This is a system generated message. We request you not to reply to this message.</b></i></font></pre>";
                                                        emailid = (string)ActionController.ExecuteAction(txt_Username.Text, "Advance_Request_Foreign.aspx", "insetmaildata", ref isInserted, txtProcessID.Text, txtInstanceID.Text, 0, "FOREIGN ADVANCE REQUEST APPROVAL", "APPROVE", txtApproverEmail.Text, Init_Email.Text, msg, "Request No: " + spn_req_no.InnerHtml);
                                                    }
                                                    catch (Exception)
                                                    {
                                                        throw;
                                                    }
                                                    finally
                                                    {
                                                        Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Foreign Advance Request has been sent for account payment approval.!');window.open('../../Portal/SCIL/Home.aspx','frmset_WorkArea');}</script>");
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Release Step Not Found ...!');window.open('../../Portal/SCIL/TaskDetails.aspx','frmset_WorkArea');}</script>");
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                else if (ddlAction.SelectedItem.Text == "Reject")
                {
                    txt_Condition.Text = "2";
                    txt_Audit.Text     = "FOREIGN ADVANCE REQUEST APPROVAL";
                    string isSaved = (string)ActionController.ExecuteAction("", "Advance_Request_Approval_Foreign.aspx", "update", ref ref_data, Convert.ToInt32(txt_Condition.Text), txtProcessID.Text, txtInstanceID.Text, txt_Audit.Text, txt_Username.Text, remark, ddlAction.SelectedItem.Text);
                    if (isSaved == null || ref_data.Length > 0 || isSaved == "false")
                    {
                        string[] errmsg = ref_data.Split(':');
                        Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('" + errmsg[0].ToString() + "');}</script>");
                    }
                    else
                    {
                        string[] Dval = new string[1];
                        Dval[0] = txt_Username.Text;
                        string ref_data1  = string.Empty;
                        string release_id = (string)ActionController.ExecuteAction("", "Advance_Request_Foreign.aspx", "getreleaseid", ref ref_data1, txtProcessID.Text, step_name.Text, "REJECT");
                        if (release_id != "")
                        {
                            bool isCreate = (bool)WFE.Action.ReleaseStep(txtProcessID.Text, txtInstanceID.Text, release_id, step_name.Text, "REJECT", txt_Username.Text, txt_Username.Text.Trim(), "", "", "", "", "", "", "", "", "", "", Dval, txt_Request.Text, txtWIID.Text, ref isInserted);
                            if (isCreate)
                            {
                                try
                                {
                                    string msg = "<pre><font size='3'>Dear Sir/Madam,</font></pre><p/> <pre><font size='3'>Foreign Advance Request has been Rejected.</font></pre><p/> <pre><font size='3'>Request No: " + spn_req_no.InnerHtml + "</font></pre> <pre><font size='3'>Created By: " + txt_Initiator.Text.Trim() + "</font></pre></p><pre></b><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><br/><pre>Regards</pre><pre><b>Reporting Admin<b></pre><br/><pre></pre><br/><pre><font size='3'  color='red'><i><b>This is a system generated message. We request you not to reply to this message.</b></i></font></pre>";

                                    string emailid = (string)ActionController.ExecuteAction(txt_Username.Text, "Advance_Request_Foreign.aspx", "insetmaildata", ref isInserted, txtProcessID.Text, txtInstanceID.Text, 0, "FOREIGN ADVANCE REQUEST APPROVAL", "REJECT", Init_Email.Text, txtEmailID.Text, msg, "Request No: " + spn_req_no.InnerHtml);
                                }
                                catch (Exception)
                                {
                                    throw;
                                }
                                finally
                                {
                                    Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Foreign Advance Request has been Rejected.');window.open('../../Portal/SCIL/Home.aspx','frmset_WorkArea');}</script>");
                                }
                            }
                        }
                        else
                        {
                            Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Release Step Not Found ...!');window.open('../../Portal/SCIL/TaskDetails.aspx','frmset_WorkArea');}</script>");
                        }
                    }
                }
                else if (ddlAction.SelectedItem.Text == "Send-Back")
                {
                    txt_Condition.Text = "3";
                    txt_Audit.Text     = "FOREIGN ADVANCE REQUEST APPROVAL";
                    string isSaved = (string)ActionController.ExecuteAction("", "Advance_Request_Approval_Foreign.aspx", "update", ref ref_data, Convert.ToInt32(txt_Condition.Text), txtProcessID.Text, txtInstanceID.Text, txt_Audit.Text, txt_Username.Text, remark, ddlAction.SelectedItem.Text);
                    if (isSaved == null || ref_data.Length > 0 || isSaved == "false")
                    {
                        string[] errmsg = ref_data.Split(':');
                        Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('" + errmsg[0].ToString() + "');}</script>");
                    }
                    else
                    {
                        string[] Dval = new string[1];
                        Dval[0] = txt_Initiator.Text;
                        string ref_data1  = string.Empty;
                        string release_id = (string)ActionController.ExecuteAction("", "Advance_Request_Foreign.aspx", "getreleaseid", ref ref_data1, txtProcessID.Text, step_name.Text, "SEND-BACK");
                        if (release_id != "")
                        {
                            bool isCreate = (bool)WFE.Action.ReleaseStep(txtProcessID.Text, txtInstanceID.Text, release_id, step_name.Text, "SEND-BACK", txt_Username.Text, txt_Approver.Text.Trim(), "", "", "", "", "", "", "", "", "", "", Dval, txt_Request.Text, txtWIID.Text, ref isInserted);
                            if (isCreate)
                            {
                                try
                                {
                                    string msg = "<pre><font size='3'>Dear Sir/Madam,</font></pre><p/> <pre><font size='3'>Foreign Advance Request has been Sent back to the initiator.</font></pre><p/> <pre><font size='3'>Request No: " + spn_req_no.InnerHtml + "</font></pre> <pre><font size='3'>Created By: " + txt_Initiator.Text.Trim() + "</font></pre></p><pre></b><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><br/><pre>Regards</pre><pre><b>Reporting Admin<b></pre><br/><pre></pre><br/><pre><font size='3'  color='red'><i><b>This is a system generated message. We request you not to reply to this message.</b></i></font></pre>";

                                    string emailid = (string)ActionController.ExecuteAction(txt_Username.Text, "Advance_Request_Foreign.aspx", "insetmaildata", ref isInserted, txtProcessID.Text, txtInstanceID.Text, 0, "FOREIGN ADVANCE REQUEST APPROVAL", "SEND-BACK", Init_Email.Text, txtEmailID.Text, msg, "Request No: " + spn_req_no.InnerHtml);
                                }
                                catch (Exception)
                                {
                                    throw;
                                }
                                finally
                                {
                                    Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Foreign Advance Request has been Sent back to the initiator...!');window.open('../../Portal/SCIL/Home.aspx','frmset_WorkArea');}</script>");
                                }
                            }
                        }
                        else
                        {
                            Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Release Step Not Found ...!');window.open('../../Portal/SCIL/TaskDetails.aspx','frmset_WorkArea');}</script>");
                        }
                    }
                }
            }
        }
        catch (Exception ex)
        {
            FSL.Logging.Logger.WriteEventLog(false, ex);
        }
    }
Beispiel #28
0
    protected string getUserData(string name, int pageno, int rpp)
    {
        string        strData = string.Empty;
        string        data    = string.Empty;
        StringBuilder html    = new StringBuilder();

        try
        {
            GetData getData  = new GetData();
            string  username = Convert.ToString(Session["USER_ADID"]);
            html.Append("<table id='data-table1' class='table table-bordered table-hover' >");
            html.Append("<thead><tr class='grey center'><th>#</th><th>Material Code</th><th>Material Text</th><th>Po No</th><th>Po Date</th><th>GR acceptance Date</th><th>Plant</th><th>Payment Terms</th><th>Invoice No</th></tr></thead>");
            html.Append("<tbody>");
            DataTable dtData = (DataTable)ActionController.ExecuteAction("", "Material_Transit_Report.aspx", "getpendingpayments", ref data, username, name);
            if (dtData != null)
            {
                int ddl = rpp;
                //int from = (pageno - 1) * ddl;
                //int to = ((pageno - 1) * ddl) + ddl;
                for (int i = 0; i < dtData.Rows.Count; i++)
                {
                    //if (i < dtData.Rows.Count)
                    //{
                    CryptoGraphy crypt       = new CryptoGraphy();
                    string       encrypt_Str = crypt.Encryptdata(Convert.ToString(dtData.Rows[i]["PO_Number"]));
                    html.Append("<tr>");
                    html.Append("<td>" + (i + 1) + "</td>");
                    html.Append("<td>" + Convert.ToString(dtData.Rows[i]["Material_no"]) + "</td>");
                    html.Append("<td>" + Convert.ToString(dtData.Rows[i]["material_desc"]) + "</td>");
                    html.Append("<td><a href='#' role='button' id='anc" + (i + 1) + "' onclick='viewData(" + (i + 1) + ")'>" + Convert.ToString(dtData.Rows[i]["PO_Number"]) + "</a><input type='text' id='encrypt_po" + (i + 1) + "' value=" + encrypt_Str + " style='display:none'></td>");
                    html.Append("<td>" + Convert.ToString(dtData.Rows[i]["po_date"]) + "</td>");
                    html.Append("<td align='center'>" + Convert.ToString(dtData.Rows[i]["budat"]) + "</td>");
                    html.Append("<td>" + Convert.ToString(dtData.Rows[i]["plant"]) + "</td>");
                    html.Append("<td>" + Convert.ToString(dtData.Rows[i]["payment_terms"]) + "</td>");
                    html.Append("<td>" + Convert.ToString(dtData.Rows[i]["invoice_no"]) + "</td>");
                    html.Append("</tr>");

                    // }
                }
            }

            html.Append("</tbody>");
            html.Append("</table>");

            //double cnt = Convert.ToDouble(dtData.Rows.Count) / rpp;
            //if (cnt > Convert.ToInt16(Convert.ToInt32(dtData.Rows.Count) / rpp))
            //{
            //    cnt = (int)cnt + 1;
            //}

            //if (cnt > 1)
            //{
            //    html.Append("<div class='dataTables_paginate paging_simple_numbers' style='text-align:center'>");
            //    html.Append("<ul class='pagination'>");
            //    for (int j = 1; j <= cnt; j++)
            //    {
            //        html.Append("<li class='paginate_button' style='margin:2px;'><input type='button' value='" + j + "' class='btn btn-default buttons-copy buttons-flash' style=' font-weight:normal' onclick='gotopage(this," + rpp + ")'></li>");
            //    }
            //    html.Append("</ul></div>");
            //}
            strData = Convert.ToString(html);
        }
        catch (Exception ex)
        {
        }
        return(strData);
    }
Beispiel #29
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string isSaved    = string.Empty;
        string isInserted = string.Empty;
        string ref_data   = string.Empty;

        try
        {
            ActionController.DisablePageCaching(this);
            if (ActionController.IsSessionExpired(this))
            {
                ActionController.RedirctToLogin(this);
            }
            else
            {
                if (ddlAction.SelectedIndex > 0)
                {
                    if (ddlAction.SelectedValue == "1")
                    {
                        DataTable DTAP = new DataTable();
                        if (pay_mode.InnerHtml.ToUpper() == "CASH")
                        {
                            DTAP = (DataTable)ActionController.ExecuteAction("", "Domestic_Travel_Request_Approval.aspx", "getaccapprover", ref ref_data, "DOMESTIC TRAVEL DOC VERIFIER", pk_loc_id.Text, pk_mode_id.Text);
                        }
                        else
                        {
                            DTAP = (DataTable)ActionController.ExecuteAction("", "Domestic_Travel_Request_Approval.aspx", "getaccapprover", ref ref_data, "DOMESTIC TRAVEL DOC VERIFIER", 0, pk_mode_id.Text);
                        }
                        if (DTAP != null)
                        {
                            if (DTAP.Rows.Count > 0)
                            {
                                isSaved = (string)ActionController.ExecuteAction("", "Domestic_Travel_Request_Approval.aspx", "update", ref ref_data, txt_pk_id.Text, txt_Document_Xml.Text, 1);
                                if (isSaved == null || ref_data.Length > 0 || isSaved == "false")
                                {
                                    string[] errmsg = ref_data.Split(':');
                                    Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('" + errmsg[0].ToString() + "');}</script>");
                                }
                                else
                                {
                                    string[] Dval = new string[DTAP.Rows.Count];
                                    Dval[0] = "";
                                    if (DTAP.Rows.Count > 0)
                                    {
                                        for (int i = 0; i < DTAP.Rows.Count; i++)
                                        {
                                            Dval[i] = Convert.ToString(DTAP.Rows[i]["USER_ADID"]);
                                            if (txtApproverEmail.Text == "")
                                            {
                                                txtApproverEmail.Text = Convert.ToString(DTAP.Rows[i]["EMAIL_ID"]);
                                            }
                                            else
                                            {
                                                txtApproverEmail.Text = txtApproverEmail.Text + ',' + Convert.ToString(DTAP.Rows[i]["EMAIL_ID"]);
                                            }
                                        }
                                    }
                                    bool isCreate = (bool)WFE.Action.ReleaseStep(txtProcessID.Text, txtInstanceID.Text, "175", "TRAVEL EXPENSE DEVIATION APPROVAL", "SUBMIT", txt_Username.Text, txt_Username.Text.Trim(), "", "", "", "", "", "", "", "", "", "", Dval, spn_req_no.InnerHtml, txtWIID.Text, ref isInserted);
                                    if (isCreate)
                                    {
                                        try
                                        {
                                            string auditid = (string)ActionController.ExecuteAction(txt_initiator.Text, "Domestic_Travel_Request.aspx", "insertaudittrail", ref isInserted, txtProcessID.Text, txtInstanceID.Text, "TRAVEL EXPENSE DEVIATION APPROVAL", "USER", txt_Username.Text, "SUBMIT", "Send For Document Approval", "0", "0");

                                            //string msg = "<pre><font size='3'>Dear Sir/Madam,</font></pre><pre><font size='3'>Domestic Travel Request Has Been Approved Succefully and Sent For Document Verification.</font></pre><pre><font size='3'>Request No: " + spn_req_no.InnerHtml + "</font></pre><pre><font size='3'>Created By: " + span_ename.InnerHtml.Trim() + "</font></pre><pre><pre>INTRANET URL:http://" + compname + "/Sudarshan-Portal/Login.aspx</pre><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><pre></pre><pre><font size='3'  color='red'><i><b>This is a system generated message. We request you not to reply to this message.</b></i></font></pre>";
                                            string       msg          = "";
                                            CryptoGraphy crypt        = new CryptoGraphy();
                                            string       process_name = crypt.Encryptdata("TRAVEL EXPENSE");
                                            string       req_no       = crypt.Encryptdata(spn_req_no.InnerHtml);
                                            if (pay_mode.InnerHtml.ToUpper() == "CASH")
                                            {
                                                msg = "<pre><span style='font-size: medium;'>Dear Sir/Madam,</span></pre><pre><span style='font-size: medium;'>Domestic Travel Request Has Been Approved Succefully and Sent For Document Verification.</span></pre><pre><span style='font-size: medium;'>Request No: " + spn_req_no.InnerHtml + "</span></pre><pre><span style='font-size: medium;'>Created By: " + span_ename.InnerHtml.Trim() + "</span></pre><pre><span style='font-size: medium;'>Please Take Voucher Print By Link Given Below : </span></pre><pre><span style='font-size: medium;'>INTERNET URL:<a href='https://" + compname + "/Sudarshan-Portal/Vouchers/Cash_Voucher.aspx?P=" + process_name + "&R=" + req_no + "'>https://" + compname + "/Sudarshan-Portal/Vouchers/Cash_Voucher.aspx?P=" + process_name + "&R=" + req_no + "</a></span></pre><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><pre>&nbsp;</pre><pre><span style='color: red; font-size: medium;'><em><strong>Kindly attach all the original supporting documents with the voucher print & submit to the Cashier in case mode of payment requested is cash otherwise, send the documents to the Cashier at GHO Pune.</strong></em></span></pre>";
                                            }
                                            else
                                            {
                                                msg = "<pre><span style='font-size: medium;'>Dear Sir/Madam,</span></pre><pre><span style='font-size: medium;'>Domestic Travel Request Has Been Approved Succefully and Sent For Document Verification.</span></pre><pre><span style='font-size: medium;'>Request No: " + spn_req_no.InnerHtml + "</span></pre><pre><span style='font-size: medium;'>Created By: " + span_ename.InnerHtml.Trim() + "</span></pre><pre><span style='font-size: medium;'>Please Take Voucher Print By Link Given Below : </span></pre><pre><span style='font-size: medium;'>INTERNET URL:<a href='https://" + compname + "/Sudarshan-Portal/Vouchers/Bank_Voucher.aspx?P=" + process_name + "&R=" + req_no + "'>https://" + compname + "/Sudarshan-Portal/Vouchers/Bank_Voucher.aspx?P=" + process_name + "&R=" + req_no + "</a></span></pre><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><pre>&nbsp;</pre><pre><span style='color: red; font-size: medium;'><em><strong>Kindly attach all the original supporting documents with the voucher print & submit to the Cashier in case mode of payment requested is cash otherwise, send the documents to the Cashier at GHO Pune.</strong></em></span></pre>";
                                            }
                                            string emailid = (string)ActionController.ExecuteAction(txt_Username.Text, "Domestic_Travel_Request.aspx", "insetmaildata", ref isInserted, txtProcessID.Text, txtInstanceID.Text, 0, "TRAVEL EXPENSE DEVIATION APPROVAL", "SUBMIT", txt_init_mail.Text, txtApproverEmail.Text, msg, "Request No: " + spn_req_no.InnerHtml);
                                        }
                                        catch (Exception)
                                        {
                                            throw;
                                        }
                                        finally
                                        {
                                            Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Domestic Travel Request Has Been Approved and Sent For Document Verification...!');window.open('../../Portal/SCIL/Home.aspx','frmset_WorkArea');}</script>");
                                        }
                                    }
                                }    //
                            }
                            else
                            {
                                Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Document Verifier Not Available For " + pay_mode.InnerHtml + " Payment Mode...!');window.open('../../Portal/SCIL/TaskDetails.aspx','frmset_WorkArea');}</script>");
                            }
                        }
                        else
                        {
                            Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Document Verifier Not Available For " + pay_mode.InnerHtml + " Payment Mode...!');window.open('../../Portal/SCIL/TaskDetails.aspx','frmset_WorkArea');}</script>");
                        }
                    }
                    else if (ddlAction.SelectedValue == "2")
                    {
                        isSaved = (string)ActionController.ExecuteAction("", "Domestic_Travel_Request_Approval.aspx", "update", ref ref_data, txt_pk_id.Text, txt_Document_Xml.Text, "2");
                        if (isSaved == null || ref_data.Length > 0 || isSaved == "false")
                        {
                            string[] errmsg = ref_data.Split(':');
                            Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('" + errmsg[0].ToString() + "');}</script>");
                        }
                        else
                        {
                            string[] Dval = new string[1];
                            Dval[0] = txt_initiator.Text;
                            bool isCreate = (bool)WFE.Action.ReleaseStep(txtProcessID.Text, txtInstanceID.Text, "176", "TRAVEL EXPENSE DEVIATION APPROVAL", "SEND-BACK", txt_Username.Text, txt_initiator.Text.Trim(), txt_initiator.Text.Trim(), "", "", "", "", "", "", "", "", "", Dval, spn_req_no.InnerHtml, txtWIID.Text, ref isInserted);
                            if (isCreate)
                            {
                                try
                                {
                                    string auditid = (string)ActionController.ExecuteAction(txt_initiator.Text, "Domestic_Travel_Request.aspx", "insertaudittrail", ref isInserted, txtProcessID.Text, txtInstanceID.Text, "TRAVEL EXPENSE DEVIATION APPROVAL", "USER", txt_Username.Text, "SEND-BACK", txt_Remark.Text, "0", "0");

                                    string msg = "<pre><font size='3'>Dear Sir/Madam,</font></pre><pre><font size='3'>Domestic Travel Request Has Been Sent Back To Initiator Successfully.</font></pre><pre><font size='3'>Request No: " + spn_req_no.InnerHtml + "</font></pre><pre><font size='3'>Created By: " + span_ename.InnerHtml.Trim() + "</font></pre><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><pre></pre><pre><font size='3'  color='red'><i><b>This is a system generated message. We request you not to reply to this message.</b></i></font></pre>";

                                    string emailid = (string)ActionController.ExecuteAction(txt_Username.Text, "Domestic_Travel_Request.aspx", "insetmaildata", ref isInserted, txtProcessID.Text, txtInstanceID.Text, 0, "TRAVEL EXPENSE DEVIATION APPROVAL", "SEND-BACK", txt_init_mail.Text, "", msg, "Request No: " + spn_req_no.InnerHtml);
                                }
                                catch (Exception)
                                {
                                    throw;
                                }
                                finally
                                {
                                    Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Domestic Travel Request Has Been Sent Back To Initiator Successfully...!');window.open('../../Portal/SCIL/Home.aspx','frmset_WorkArea');}</script>");
                                }
                            }
                        }
                    }
                    else if (ddlAction.SelectedValue == "3")
                    {
                        isSaved = (string)ActionController.ExecuteAction("", "Domestic_Travel_Request_Approval.aspx", "update", ref ref_data, txt_pk_id.Text, txt_Document_Xml.Text, "3");
                        if (isSaved == null || ref_data.Length > 0 || isSaved == "false")
                        {
                            string[] errmsg = ref_data.Split(':');
                            Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('" + errmsg[0].ToString() + "');}</script>");
                        }
                        else
                        {
                            string[] Dval = new string[1];
                            Dval[0] = txt_Username.Text;
                            bool isCreate = (bool)WFE.Action.ReleaseStep(txtProcessID.Text, txtInstanceID.Text, "177", "TRAVEL EXPENSE DEVIATION APPROVAL", "REJECT", txt_Username.Text, txt_Username.Text.Trim(), "", "", "", "", "", "", "", "", "", "", Dval, spn_req_no.InnerHtml, txtWIID.Text, ref isInserted);
                            if (isCreate)
                            {
                                try
                                {
                                    string auditid = (string)ActionController.ExecuteAction(txt_initiator.Text, "Domestic_Travel_Request.aspx", "insertaudittrail", ref isInserted, txtProcessID.Text, txtInstanceID.Text, "TRAVEL EXPENSE DEVIATION APPROVAL", "USER", txt_Username.Text, "REJECT", txt_Remark.Text, "0", "0");

                                    string msg = "<pre><font size='3'>Dear Sir/Madam,</font></pre><pre><font size='3'>Domestic Travel Request Has Been Rejected.</font></pre><pre><font size='3'>Request No: " + spn_req_no.InnerHtml + "</font></pre><pre><font size='3'>Created By: " + span_ename.InnerHtml.Trim() + "</font></pre><pre><pre>INTRANET URL:http://" + compname + "/Sudarshan-Portal/Login.aspx</pre><pre>INTERNET URL:https://" + compname + "/Sudarshan-Portal/Login.aspx</pre><pre></pre><pre><font size='3'  color='red'><i><b>This is a system generated message. We request you not to reply to this message.</b></i></font></pre>";

                                    string emailid = (string)ActionController.ExecuteAction(txt_Username.Text, "Domestic_Travel_Request.aspx", "insetmaildata", ref isInserted, txtProcessID.Text, txtInstanceID.Text, 0, "TRAVEL EXPENSE DEVIATION APPROVAL", "REJECT", txt_init_mail.Text, "", msg, "Request No: " + spn_req_no.InnerHtml);
                                }
                                catch (Exception)
                                {
                                    throw;
                                }
                                finally
                                {
                                    Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Domestic Travel Request Has Been Rejected...!');window.open('../../Portal/SCIL/Home.aspx','frmset_WorkArea');}</script>");
                                }
                            }
                        }
                    }
                }
                else
                {
                    Page.RegisterStartupScript("onclick", "<script language='javascript'>{alert('Please Select Action...');}</script>");
                }
            }
        }
        catch (Exception Exc) { FSL.Logging.Logger.WriteEventLog(false, Exc); }
    }
    //Function to Insert Records
    private void InsertCSVRecords(DataTable csvdt)
    {
        string ip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
        //bool IsSuccessSave = false;
        //SqlTransaction transaction = null;
        DataTable dtInsrt = new DataTable();

        dtInsrt = csvdt.Clone();

        DataColumn myColumn = new DataColumn();

        myColumn.DataType     = System.Type.GetType("System.Int32");
        myColumn.AllowDBNull  = false;
        myColumn.Caption      = "intUserTypeID";
        myColumn.ColumnName   = "intUserTypeID";
        myColumn.DefaultValue = 1;

        DataColumn myColumndtAddedOn = new DataColumn();

        myColumndtAddedOn.DataType     = System.Type.GetType("System.DateTime");
        myColumndtAddedOn.AllowDBNull  = false;
        myColumndtAddedOn.Caption      = "dtAddedOn";
        myColumndtAddedOn.ColumnName   = "dtAddedOn";
        myColumndtAddedOn.DefaultValue = DateTime.Now;

        dtInsrt.Columns.Add(myColumn);
        dtInsrt.Columns.Add(myColumndtAddedOn);

        for (int i = 0; i < csvdt.Rows.Count; i++)
        {
            CryptoGraphy objEncrypt = new CryptoGraphy();

            dtInsrt.ImportRow(csvdt.Rows[i]);
            dtInsrt.Rows[i]["Email"]        = Convert.ToString(dtInsrt.Rows[i]["Email"]).Replace("\r", null);
            dtInsrt.Rows[i]["vchrPassword"] = objEncrypt.Encrypt(Convert.ToString(csvdt.Rows[i]["vchrPassword"]));
        }

        SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);

        using (SqlBulkCopy objbulk = new SqlBulkCopy(conn))
        {
            //assigning Destination table name
            objbulk.DestinationTableName = "Scrl_RegistrationTbl";
            //Mapping Table column

            objbulk.ColumnMappings.Add("FirstName", "vchrFirstName");
            objbulk.ColumnMappings.Add("LastName", "vchrLastName");
            objbulk.ColumnMappings.Add("Email", "vchrUserName");
            objbulk.ColumnMappings.Add("vchrActive", "vchrActive");
            objbulk.ColumnMappings.Add("vchrPassword", "vchrPassword");
            objbulk.ColumnMappings.Add("intUserTypeID", "intUserTypeID");
            objbulk.ColumnMappings.Add("dtAddedOn", "dtAddedOn");
            //dtAddedOn
            //Inserting Datatable Records to DataBase
            conn.Open();
            //transaction.Commit();
            //IsSuccessSave = true;
            objbulk.WriteToServer(dtInsrt);
            conn.Close();

            for (int i = 0; i < csvdt.Rows.Count; i++)
            {
                SendMail(csvdt.Rows[i]["Email"].ToString().Replace("\r", null), csvdt.Rows[i]["vchrPassword"].ToString(), csvdt.Rows[i]["FirstName"].ToString() + " " + csvdt.Rows[i]["LastName"].ToString());

                DataTable dtRecord = new DataTable();
                dtRecord.Clear();
                objdoreg.UserName = csvdt.Rows[i]["Email"].ToString().Replace("\r", null);
                dtRecord          = objdareg.GetDataTableRecord(objdoreg, DA_Registrationdetails.RegistrationDetails.UserRecordByMail);
                //string id = "id=" + dtRecord.Rows[0]["intRegistrationId"].ToString();
                //dt = objLoginDB.GetDataTable(objLogin, DA_SKORKEL.DA_Login.Login_1.UserDetails);

                if (ISAPIURLACCESSED == "1")
                {
                    StringBuilder UserURL = new StringBuilder();
                    UserURL.Append(APIURL);
                    UserURL.Append("registerUser.action?");
                    UserURL.Append("uid=");
                    UserURL.Append(Convert.ToString(dtRecord.Rows[0]["intRegistrationId"]));
                    UserURL.Append("&userId=");
                    UserURL.Append(Convert.ToString(dtRecord.Rows[0]["vchrUserName"]));
                    UserURL.Append("&password="******"vchrPassword"]));
                    UserURL.Append("&firstName=");
                    UserURL.Append(Convert.ToString(dtRecord.Rows[0]["vchrFirstName"]));
                    UserURL.Append("&lastName=");
                    UserURL.Append(Convert.ToString(dtRecord.Rows[0]["vchrLastName"]));
                    UserURL.Append("&userType=STUDENT");
                    UserURL.Append("&userContextIds=" + null);
                    UserURL.Append("&friendUserIds=" + null);
                    UserURL.Append("&lawRelated=" + null);

                    try
                    {
                        HttpWebRequest myRequest1 = (HttpWebRequest)WebRequest.Create(UserURL.ToString());
                        myRequest1.Method = "GET";
                        WebResponse myResponse1 = myRequest1.GetResponse();

                        StreamReader sr     = new StreamReader(myResponse1.GetResponseStream(), System.Text.Encoding.UTF8);
                        String       result = sr.ReadToEnd();

                        objAPILogDO.strURL      = UserURL.ToString();
                        objAPILogDO.strAPIType  = "Student";
                        objAPILogDO.strResponse = result;

                        if (ip == null)
                        {
                            objAPILogDO.strIPAddress = Request.ServerVariables["REMOTE_ADDR"];
                        }
                        objAPILogDA.AddEditDel_Scrl_APILogDetailsTbl(objAPILogDO, DA_Scrl_APILogDetailsTbl.Scrl_APILogDetailsTbl.Insert);
                    }
                    catch (Exception ex)
                    { ex.Message.ToString(); }
                }
            }
            lblError.Visible = true;
            lblError.Text    = "User's list uploaded successfully.";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "starScripts1", "hideLoader1();", true);
        }
    }