private bool SaveData()
 {
     objCommon = new clsCommon();
     if (objCommon.IsRecordExists("tblOrderStatus", tblOrderStatus.ColumnNames.AppOrderStatus, tblOrderStatus.ColumnNames.AppOrderStatusID, txtOrderStatus.Text, hdnPKID.Value))
     {
         DInfo.ShowMessage("Order Status alredy exits.", Enums.MessageType.Error);
         return(false);
     }
     objOrderStatus = new tblOrderStatus();
     if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "")
     {
         objOrderStatus.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value));
     }
     else
     {
         objOrderStatus.AddNew();
         objOrderStatus.AppDisplayOrder = objCommon.GetNextDisplayOrder("tblOrderStatus", tblOrderStatus.ColumnNames.AppDisplayOrder);
     }
     objOrderStatus.AppOrderStatus = txtOrderStatus.Text;
     objOrderStatus.AppIsActive    = chkIsActive.Checked;
     if (chkIsDefault.Checked)
     {
         tblOrderStatus ObjTempcolor = new tblOrderStatus();
         ObjTempcolor.SetDefaultOrderStatus();
         ObjTempcolor = null;
         objOrderStatus.AppIsActive  = true;
         objOrderStatus.AppIsDefault = true;
     }
     else
     {
         tblOrderStatus ObjTempcolor = new tblOrderStatus();
         ObjTempcolor.LoadAll();
         if (ObjTempcolor.RowCount <= 0)
         {
             objOrderStatus.AppIsActive  = true;
             objOrderStatus.AppIsDefault = true;
         }
         else
         {
             objOrderStatus.AppIsDefault = false;
         }
         ObjTempcolor = null;
     }
     objOrderStatus.Save();
     intPkId        = objOrderStatus.AppOrderStatusID;
     objOrderStatus = null;
     objCommon      = null;
     return(true);
 }
Exemplo n.º 2
0
    private void LoadDataGrid(bool IsResetPageIndex, bool IsSort, string strFieldName = "", string strFieldValue = "")
    {
        objOrderStatus = new tblOrderStatus();

        objDataTable = objOrderStatus.LoadGridData(ddlFields.SelectedValue, txtSearch.Text.Trim());

        //'Reset PageIndex of gridviews
        if (IsResetPageIndex)
        {
            if (dgvGridView.PageCount > 0)
            {
                dgvGridView.PageIndex = 0;
            }
        }

        dgvGridView.DataSource = null;
        dgvGridView.DataBind();
        lblCount.Text        = 0.ToString();
        hdnSelectedIDs.Value = "";

        //'Check for data into datatable
        if (objDataTable.Rows.Count <= 0)
        {
            DInfo.ShowMessage("No data found", Enums.MessageType.Information);
            return;
        }
        else
        {
            if (ddlPerPage.SelectedItem.Text.ToLower() == "all")
            {
                dgvGridView.AllowPaging = false;
            }
            else
            {
                dgvGridView.AllowPaging = true;
                dgvGridView.PageSize    = Convert.ToInt32(ddlPerPage.SelectedItem.Text);
            }

            lblCount.Text          = objDataTable.Rows.Count.ToString();
            objDataTable           = SortDatatable(objDataTable, ViewState["SortColumn"].ToString(), (appFunctions.Enum_SortOrderBy)ViewState["SortOrder"], IsSort);
            dgvGridView.DataSource = objDataTable;
            dgvGridView.DataBind();
        }

        objOrderStatus = null;
    }
Exemplo n.º 3
0
        public static SalesOrderStatus ToCustomerOrderStatus(this tblOrderStatus status)
        {
            switch (status)
            {
            case tblOrderStatus.Scheduled:
            case tblOrderStatus.Staged:
            case tblOrderStatus.Shipped:
            case tblOrderStatus.Treated:
            case tblOrderStatus.Void:
                return(SalesOrderStatus.Ordered);

            case tblOrderStatus.Invoiced:
                return(SalesOrderStatus.Invoiced);

            default: throw new ArgumentOutOfRangeException("status");
            }
        }
 private void SetValuesToControls()
 {
     if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "")
     {
         objOrderStatus = new tblOrderStatus();
         if (objOrderStatus.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value)))
         {
             txtOrderStatus.Text  = objOrderStatus.AppOrderStatus;
             chkIsActive.Checked  = objOrderStatus.AppIsActive;
             chkIsDefault.Checked = objOrderStatus.AppIsDefault;
             if (chkIsDefault.Checked)
             {
                 chkIsDefault.Enabled = false;
             }
         }
         objOrderStatus = null;
     }
 }
Exemplo n.º 5
0
    private bool Delete(int intPKID)
    {
        bool retval = false;

        objOrderStatus = new tblOrderStatus();

        var _with1 = objOrderStatus;

        if (_with1.LoadByPrimaryKey(intPKID))
        {
            _with1.MarkAsDeleted();
            _with1.Save();
        }

        retval         = true;
        objOrderStatus = null;
        return(retval);
    }
Exemplo n.º 6
0
    public void SetOrderCount()
    {
        tblOrderStatus objOrderStatus = new tblOrderStatus();
        DataTable      objTempTable   = objOrderStatus.GetCountStatusWiseSubOrder();

        if (objTempTable.Rows.Count > 0)
        {
            lblOrdered.Text     = "[ " + objTempTable.Compute("sum(TotalCount)", tblOrderStatus.ColumnNames.AppOrderStatusID + "=" + Convert.ToInt32(Enums.Enums_OrderStatus.Ordered)).ToString() + " ]";
            lblConfirmed.Text   = "[ " + objTempTable.Compute("sum(TotalCount)", tblOrderStatus.ColumnNames.AppOrderStatusID + "=" + Convert.ToInt32(Enums.Enums_OrderStatus.Confirmed)).ToString() + " ]";
            lblReady.Text       = "[ " + objTempTable.Compute("sum(TotalCount)", tblOrderStatus.ColumnNames.AppOrderStatusID + "=" + Convert.ToInt32(Enums.Enums_OrderStatus.ReadyToShip)).ToString() + " ]";
            lblShipped.Text     = "[ " + objTempTable.Compute("sum(TotalCount)", tblOrderStatus.ColumnNames.AppOrderStatusID + "=" + Convert.ToInt32(Enums.Enums_OrderStatus.Shipped)).ToString() + " ]";
            lblDelivered.Text   = "[ " + objTempTable.Compute("sum(TotalCount)", tblOrderStatus.ColumnNames.AppOrderStatusID + "=" + Convert.ToInt32(Enums.Enums_OrderStatus.Delivered)).ToString() + " ]";
            lblCancelled.Text   = "[ " + objTempTable.Compute("sum(TotalCount)", tblOrderStatus.ColumnNames.AppOrderStatusID + " in (" + Convert.ToInt32(Enums.Enums_OrderStatus.CancelledByAdmin) + "," + Convert.ToInt32(Enums.Enums_OrderStatus.CancelledByCustomer) + ")").ToString() + " ]";
            lblReturned.Text    = "[ " + objTempTable.Compute("sum(TotalCount)", tblOrderStatus.ColumnNames.AppOrderStatusID + "=" + Convert.ToInt32(Enums.Enums_OrderStatus.Returned)).ToString() + " ]";
            lblComplete.Text    = "[ " + objTempTable.Compute("sum(TotalCount)", tblOrderStatus.ColumnNames.AppOrderStatusID + "=" + Convert.ToInt32(Enums.Enums_OrderStatus.Complete)).ToString() + " ]";
            lblPaymentFail.Text = "[ " + objTempTable.Compute("sum(TotalCount)", tblOrderStatus.ColumnNames.AppOrderStatusID + "=" + Convert.ToInt32(Enums.Enums_OrderStatus.PaymentFail)).ToString() + " ]";
        }
        objOrderStatus = null;
    }
Exemplo n.º 7
0
    protected void dgvGridView_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
    {
        if (!string.IsNullOrEmpty(e.CommandArgument.ToString()))
        {
            objCommon = new clsCommon();

            if (e.CommandName == "Up")
            {
                LinkButton  inkButton = (LinkButton)e.CommandSource;
                GridViewRow drCurrent = (GridViewRow)inkButton.Parent.Parent;
                if (drCurrent.RowIndex > 0)
                {
                    GridViewRow drUp = dgvGridView.Rows[drCurrent.RowIndex - 1];
                    objCommon.SetDisplayOrder("tblOrderStatus", tblOrderStatus.ColumnNames.AppOrderStatusID, tblOrderStatus.ColumnNames.AppDisplayOrder, (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[0], (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[1], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[0], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[1]);
                    LoadDataGrid(false, false);
                    objCommon = null;
                }
            }
            else if (e.CommandName == "Down")
            {
                LinkButton  lnkButton = (LinkButton)e.CommandSource;
                GridViewRow drCurrent = (GridViewRow)lnkButton.Parent.Parent;
                if (drCurrent.RowIndex < dgvGridView.Rows.Count - 1)
                {
                    GridViewRow drUp = dgvGridView.Rows[drCurrent.RowIndex + 1];
                    objCommon.SetDisplayOrder("tblOrderStatus", tblOrderStatus.ColumnNames.AppOrderStatusID, tblOrderStatus.ColumnNames.AppDisplayOrder, (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[0], (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[1], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[0], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[1]);
                    LoadDataGrid(false, false);
                    objCommon = null;
                }
            }
            else if (e.CommandName == "IsActive")
            {
                objOrderStatus = new tblOrderStatus();
                if (objOrderStatus.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())))
                {
                    if (!objOrderStatus.AppIsDefault)
                    {
                        if (objOrderStatus.AppIsActive == true)
                        {
                            objOrderStatus.AppIsActive = false;
                        }
                        else if (objOrderStatus.AppIsActive == false)
                        {
                            objOrderStatus.AppIsActive = true;
                        }
                        objOrderStatus.Save();

                        LoadDataGrid(false, false);
                    }
                }
                objOrderStatus = null;
            }
            else if (e.CommandName == "IsDefault")
            {
                objOrderStatus = new tblOrderStatus();
                objOrderStatus.SetDefaultOrderStatus(e.CommandArgument.ToString());
                objOrderStatus = null;
                LoadDataGrid(false, false);
            }
        }
    }
Exemplo n.º 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            CheckSession();
            SetUpPageContent(ref metaDescription, ref metaKeywords);
            objCommon = new clsCommon();
            try
            {
                string[] merc_hash_vars_seq;
                string   merc_hash_string = string.Empty;
                string   merc_hash        = string.Empty;
                string   order_id         = string.Empty;
                string   strOrderId       = "";
                string   strTransactionId = "";
                bool     IsSuccess        = false;
                if (Session[appFunctions.Session.PaymetnOrderId.ToString()] != null)
                {
                    if (Session[appFunctions.Session.PaymetnOrderId.ToString()].ToString() != "")
                    {
                        strOrderId = Session[appFunctions.Session.PaymetnOrderId.ToString()].ToString();
                        Session[appFunctions.Session.PaymetnOrderId.ToString()] = "";
                        Session[appFunctions.Session.PaymetnOrderId.ToString()] = null;
                    }
                }
                if (Session[appFunctions.Session.PaymentTransactionId.ToString()] != null)
                {
                    if (Session[appFunctions.Session.PaymentTransactionId.ToString()].ToString() != "")
                    {
                        strTransactionId = Session[appFunctions.Session.PaymentTransactionId.ToString()].ToString();
                        Session[appFunctions.Session.PaymentTransactionId.ToString()] = "";
                        Session[appFunctions.Session.PaymentTransactionId.ToString()] = null;
                    }
                }

                if (Request.Form["status"] == "success")
                {
                    merc_hash_vars_seq = appFunctions.hashSequence.Split('|');
                    Array.Reverse(merc_hash_vars_seq);
                    merc_hash_string = appFunctions.SALT + "|" + Request.Form["status"];
                    foreach (string merc_hash_var in merc_hash_vars_seq)
                    {
                        merc_hash_string += "|";
                        merc_hash_string  = merc_hash_string + (Request.Form[merc_hash_var] != null ? Request.Form[merc_hash_var] : "");
                    }
                    // Response.Write(merc_hash_string);
                    //return;
                    merc_hash = objCommon.Generatehash512(merc_hash_string).ToLower();
                    if (merc_hash != Request.Form["hash"])
                    {
                        //Response.Write("Hash value did not matched");
                        DInfo.ShowMessage("Your online payment Failed", BusinessLayer.Enums.MessageType.Error);
                        IsSuccess = false;
                    }
                    else
                    {
                        IsSuccess = true;
                        order_id  = Request.Form["txnid"];
                        DInfo.ShowMessage("Your online payment is done successfully and your transction ID is " + order_id + "", BusinessLayer.Enums.MessageType.Successfull);
                    }
                }
                else
                {
                    //Response.Write("Hash value did not matched");
                    IsSuccess = false;
                    DInfo.ShowMessage("Your online payment Failed", BusinessLayer.Enums.MessageType.Error);
                }

                if (strOrderId != "")
                {
                    tblOrder objOrder = new tblOrder();
                    if (objOrder.LoadByPrimaryKey(Convert.ToInt32(strOrderId)))
                    {
                        objOrder.s_AppTransactionID = order_id;
                        if (IsSuccess)
                        {
                            objOrder.AppPaymentStatus = Convert.ToInt32(Enums.Enums_PaymentStatus.success);
                            string         strDefaultOrderStatusID = "";
                            tblOrderStatus objStatus = new tblOrderStatus();
                            objStatus.Where.AppIsDefault.Value = true;
                            objStatus.Query.Load();
                            if (objStatus.RowCount > 0)
                            {
                                strDefaultOrderStatusID = objStatus.s_AppOrderStatusID;
                            }
                            objStatus = null;
                            objOrder.s_AppOrderStatusID = strDefaultOrderStatusID;
                            tblSubOrder objSubOrder = new tblSubOrder();
                            objSubOrder.SetOrderStatus(Convert.ToInt32(Enums.Enums_OrderStatus.PaymentFail), strOrderId, GetCurrentDateTime().ToString(), strDefaultOrderStatusID);
                            objSubOrder = null;
                        }
                        else
                        {
                            objOrder.AppPaymentStatus = Convert.ToInt32(Enums.Enums_PaymentStatus.Failure);
                            objOrder.AppOrderStatusID = Convert.ToInt32(Enums.Enums_OrderStatus.PaymentFail);
                            tblSubOrder objSubOrder = new tblSubOrder();
                            objSubOrder.SetOrderStatus(Convert.ToInt32(Enums.Enums_OrderStatus.PaymentFail), strOrderId, GetCurrentDateTime().ToString(), Convert.ToInt32(Enums.Enums_OrderStatus.Ordered).ToString());
                            objSubOrder = null;
                        }
                        objOrder.Save();
                        SendMail(objOrder.s_AppOrderNo, objOrder.s_AppReceiverName, objOrder.s_AppReceiverContactNo1, objOrder.s_AppRecevierEmail, IsSuccess, objOrder.s_AppTransactionID, objOrder.s_AppBankRefNo);
                        objOrder     = null;
                        objOrder     = new tblOrder();
                        objDataTable = objOrder.LoadMyOrderList(Session[appFunctions.Session.ClientUserID.ToString()].ToString(), "", strOrderId);
                        DataListMyOrder.DataSource = null;
                        DataListMyOrder.DataBind();
                        if (objDataTable.Rows.Count > 0)
                        {
                            DataListMyOrder.DataSource = objDataTable;
                            DataListMyOrder.DataBind();
                        }
                    }
                    objOrder = null;
                }
            }
            catch (Exception ex)
            {
            }
            objCommon = null;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            CheckSession();
            SetUpPageContent(ref metaDescription, ref metaKeywords);
            objCommon = new clsCommon();
            try
            {
                string strOrderId       = "";
                string strTransactionId = "";
                string order_id         = "";
                string tracking_id      = "";
                string bank_ref_no      = "";
                string order_status     = "";
                string payment_mode     = "";
                string card_name        = "";
                string currency         = "";
                bool   IsSuccess        = false;
                if (Session[appFunctions.Session.PaymetnOrderId.ToString()] != null)
                {
                    if (Session[appFunctions.Session.PaymetnOrderId.ToString()].ToString() != "")
                    {
                        strOrderId = Session[appFunctions.Session.PaymetnOrderId.ToString()].ToString();
                        Session[appFunctions.Session.PaymetnOrderId.ToString()] = "";
                        Session[appFunctions.Session.PaymetnOrderId.ToString()] = null;
                    }
                }
                if (Session[appFunctions.Session.PaymentTransactionId.ToString()] != null)
                {
                    if (Session[appFunctions.Session.PaymentTransactionId.ToString()].ToString() != "")
                    {
                        strTransactionId = Session[appFunctions.Session.PaymentTransactionId.ToString()].ToString();
                        Session[appFunctions.Session.PaymentTransactionId.ToString()] = "";
                        Session[appFunctions.Session.PaymentTransactionId.ToString()] = null;
                    }
                }
                CCACrypto           ccaCrypto   = new CCACrypto();
                string              encResponse = ccaCrypto.Decrypt(Request.Form["encResp"], appFunctions.strCCAvenueworkingKey);
                NameValueCollection Params      = new NameValueCollection();
                string[]            segments    = encResponse.Split('&');
                foreach (string seg in segments)
                {
                    string[] parts = seg.Split('=');
                    if (parts.Length > 0)
                    {
                        string Key   = parts[0].Trim();
                        string Value = parts[1].Trim();


                        Params.Add(Key, Value);
                    }
                }
                for (int i = 0; i < Params.Count; i++)
                {
                    if (Params.Keys[i].ToString().ToLower() == "order_id")
                    {
                        order_id = Params[i].ToString().ToLower();
                    }
                    else if (Params.Keys[i].ToString().ToLower() == "tracking_id")
                    {
                        tracking_id = Params[i].ToString().ToLower();
                    }
                    else if (Params.Keys[i].ToString().ToLower() == "bank_ref_no")
                    {
                        bank_ref_no = Params[i].ToString().ToLower();
                    }
                    else if (Params.Keys[i].ToString().ToLower() == "order_status")
                    {
                        order_status = Params[i].ToString().ToLower();
                    }
                    else if (Params.Keys[i].ToString().ToLower() == "payment_mode")
                    {
                        payment_mode = Params[i].ToString().ToLower();
                    }
                    else if (Params.Keys[i].ToString().ToLower() == "card_name")
                    {
                        card_name = Params[i].ToString().ToLower();
                    }
                    else if (Params.Keys[i].ToString().ToLower() == "currency")
                    {
                        currency = Params[i].ToString().ToLower();
                    }
                    //Response.Write(Params.Keys[i] + " = " + Params[i] + "<br>");
                }

                //Response.Write("order_id : " + order_id + "<br>");
                //Response.Write("tracking_id : " + tracking_id + "<br>");
                //Response.Write("bank_ref_no : " + bank_ref_no + "<br>");
                //Response.Write("order_status : " + order_status + "<br>");
                //Response.Write("payment_mode : " + payment_mode + "<br>");
                //Response.Write("card_name : " + card_name + "<br>");
                //Response.Write("currency : " + currency + "<br>");
                if (order_status == "success")
                {
                    IsSuccess = true;
                    //DInfo.ShowMessage("You Successfull Pay for order.", BusinessLayer.Enums.MessageType.Successfull);
                }
                else
                {
                    //DInfo.ShowMessage("Your online payment Failure.", BusinessLayer.Enums.MessageType.Error);
                }


                if (strOrderId != "")
                {
                    tblOrder objOrder = new tblOrder();
                    if (objOrder.LoadByPrimaryKey(Convert.ToInt32(strOrderId)))
                    {
                        objOrder.s_AppTransactionID = order_id;
                        objOrder.s_AppBankRefNo     = bank_ref_no;
                        objOrder.s_AppPaymentType   = payment_mode;
                        objOrder.s_AppCardName      = card_name;
                        objOrder.s_AppCurrency      = currency;
                        if (IsSuccess)
                        {
                            objOrder.AppPaymentStatus = Convert.ToInt32(Enums.Enums_PaymentStatus.success);
                            string         strDefaultOrderStatusID = "";
                            tblOrderStatus objStatus = new tblOrderStatus();
                            objStatus.Where.AppIsDefault.Value = true;
                            objStatus.Query.Load();
                            if (objStatus.RowCount > 0)
                            {
                                strDefaultOrderStatusID = objStatus.s_AppOrderStatusID;
                            }
                            objStatus = null;
                            objOrder.s_AppOrderStatusID = strDefaultOrderStatusID;
                            tblSubOrder objSubOrder = new tblSubOrder();
                            objSubOrder.SetOrderStatus(Convert.ToInt32(strDefaultOrderStatusID), strOrderId, GetCurrentDateTime().ToString(), Convert.ToInt32(Enums.Enums_OrderStatus.PaymentFail).ToString());
                            objSubOrder = null;
                        }
                        else
                        {
                            objOrder.AppPaymentStatus = Convert.ToInt32(Enums.Enums_PaymentStatus.Failure);
                            objOrder.AppOrderStatusID = Convert.ToInt32(Enums.Enums_OrderStatus.PaymentFail);
                            tblSubOrder objSubOrder = new tblSubOrder();
                            objSubOrder.SetOrderStatus(Convert.ToInt32(Enums.Enums_OrderStatus.PaymentFail), strOrderId, GetCurrentDateTime().ToString(), Convert.ToInt32(Enums.Enums_OrderStatus.PaymentFail).ToString());
                            objSubOrder = null;
                        }
                        objOrder.Save();
                        SendMail(objOrder.s_AppOrderNo, objOrder.s_AppReceiverName, objOrder.s_AppReceiverContactNo1, objOrder.s_AppRecevierEmail, IsSuccess, objOrder.s_AppTransactionID, objOrder.s_AppBankRefNo);
                        objOrder     = null;
                        objOrder     = new tblOrder();
                        objDataTable = objOrder.LoadMyOrderList(Session[appFunctions.Session.ClientUserID.ToString()].ToString(), "", strOrderId);
                        DataListMyOrder.DataSource = null;
                        DataListMyOrder.DataBind();
                        if (objDataTable.Rows.Count > 0)
                        {
                            DataListMyOrder.DataSource = objDataTable;
                            DataListMyOrder.DataBind();
                        }
                    }
                    objOrder = null;
                }
            }
            catch (Exception ex)
            {
            }
            objCommon = null;
        }
    }