protected void lb_SalesOrder_Released_Click(object sender, EventArgs e)
    {
        try
        {
            NetworkCredential NetCredentials = new NetworkCredential();
            NetCredentials.UserName = ConfigurationManager.AppSettings["UserName"];
            NetCredentials.Password = ConfigurationManager.AppSettings["Password"];

            // Released Sales Order By Code unit function
            Web_Order_Mail objser1 = new Web_Order_Mail();
            objser1.UseDefaultCredentials = true;
            objser1.Credentials           = NetCredentials;
            objser1.ReleaseSalesOrder(Convert.ToString(ViewState["SalesOrder"]));
            objser1 = null;

            var message = new JavaScriptSerializer().Serialize("Sales Order No: " + Convert.ToString(ViewState["SalesOrder"]) + " has been released successfully.");
            var script  = string.Format("alert({0});window.location='DashBoard.aspx';", message);
            ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "", script, true);
        }
        catch (Exception ex)
        {
            var message = new JavaScriptSerializer().Serialize(ex.Message.ToString());
            var script  = string.Format("alert({0});", message);
            ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "", script, true);
        }
    }