protected void Page_Load(object sender, EventArgs e)
        {
            //User information and Token Session


            if (Session["userName"] != null)
            {
                userName = Session["userName"].ToString();
            }

            if (Session["token"] != null)
            {
                token = Session["token"].ToString();
            }

            var _response = client.GetAllSells(userName, token);

            // var response = client.GetIntentionToBuy(userName,token);

            if (_response.Error.Code != "AG000")
            {
                // TOO: Manejar error
            }
            else
            {
                HistoryGrid.DataSource = _response.SellList.ToList();
                HistoryGrid.DataBind();
            }
        }
Esempio n. 2
0
    /// <summary>
    /// Called when the smartpart has been bound.  Derived components should override this method to run code that depends on entity context being set and it not changing.
    /// </summary>
    protected override void OnFormBound()
    {
        base.OnFormBound();

        string entityName = EntityService.GetExtendedEntityAttribute("TableName");

        entityName = entityName.Substring(0, 1).ToUpper() + entityName.Substring(1, entityName.Length - 1).ToLower();
        string entityID = EntityService.EntityID.ToString();

        string keyId = "AccountId";

        switch (entityName)
        {
        case "Contact":
            keyId = "ContactId";
            break;

        case "Opportunity":
            keyId = "OpportunityId";
            break;

        case "Ticket":
            keyId = "TicketId";
            break;

        case "Lead":
            keyId = "LeadId";
            BoundField leadField = (BoundField)HistoryGrid.Columns[3];
            if (leadField != null)
            {
                leadField.Visible = false;
            }
            break;

        //=============================================================
        // TAC Customized below this line 26-05-2010
        //=============================================================
        case "Emailarchive":
            keyId = "EMAILARCHIVEID";
            break;

        case "Oppfulfiltask":
            keyId = "FulfilmentTaskID";
            break;
            //=============================================================
            // TAC Customized Above this line 26-05-2010
            //=============================================================
        }

        HqlBindingSource.OrderBy = "h.CompletedDate desc";
        HqlBindingSource.Where   = string.Format("h.Type != {0} and h.Type != {1} and h.{2} = '{3}'", (int)HistoryType.atNote,
                                                 (int)HistoryType.atDatabaseChange, keyId, entityID);

        HqlBindingSource.BoundGrid = HistoryGrid;
        HistoryGrid.DataBind();
    }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            user = (string)Session["user"];
            DataSet HistoryData = GetData();
            bool    hasRows     = HistoryData.Tables.Cast <DataTable>()
                                  .Any(table => table.Rows.Count != 0);

            if (hasRows)
            {
                None.Visible = false;
            }
            HistoryGrid.DataSource = HistoryData;
            HistoryGrid.DataBind();
        }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string sql      = null;
            int    sailorId = Convert.ToInt32(Session["SailorId"]);

            if (sailorId != 0)
            {
                sql = @"SELECT s.SailorName,v.Flag,sh.SignOnDate,sh.ContractPerion,c.CompanyName,r.DescMon,sh.ContractEndDate
                                 FROM ServiceHistory sh
                                 left join Sailor s on sh.SailorId=s.SailorId
                                 left join Vessel v on sh.VesselId=v.Vesselid
                                 left join Company c on v.CompanyId=c.CompanyId
                                 left join Rank r on sh.RankId=r.RankId where s.SailorId=" + sailorId.ToString();
            }
            else
            {
                sql = @"SELECT s.SailorName,v.Flag,sh.SignOnDate,sh.ContractPerion,c.CompanyName,r.DescMon,sh.ContractEndDate
                                 FROM ServiceHistory sh
                                 left join Sailor s on sh.SailorId=s.SailorId
                                 left join Vessel v on sh.VesselId=v.Vesselid
                                 left join Company c on v.CompanyId=c.CompanyId
                                 left join Rank r on sh.RankId=r.RankId";
            }
            string        dsn  = (string)ConfigurationManager.AppSettings["dsn"];
            IDbConnection conn = new SqlConnection(dsn);
            IDbCommand    cmd  = conn.CreateCommand();

            cmd.CommandText = sql;

            try
            {
                conn.Open();
                IDataReader reader = cmd.ExecuteReader();
                HistoryGrid.DataSource = reader;
                HistoryGrid.DataBind();
                reader.Close();
            }
            catch (Exception ex)
            {
                _errorMessage.Text = ex.Message;
            }
            finally
            {
                conn.Dispose();
            }
        }
Esempio n. 5
0
        void loadHistory()
        {
            String connString = System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString();

            conn = new MySql.Data.MySqlClient.MySqlConnection(connString);


            query = "SELECT * FROM ec_labs.cart WHERE username = '******' AND status = 'purchased'";

            conn.Open();
            MySqlDataAdapter sqlDa = new MySqlDataAdapter(query, conn);
            DataTable        dtbl  = new DataTable();

            sqlDa.Fill(dtbl);
            Console.WriteLine();
            HistoryGrid.DataSource = dtbl;
            HistoryGrid.DataBind();
        }
        protected void HistoryGrid_Sorting(object sender, GridViewSortEventArgs e)
        {
            if (e.SortExpression == (string)ViewState["SortColumn"])
            {
                // We are resorting the same column, so flip the sort direction
                e.SortDirection =
                    ((SortDirection)ViewState["SortColumnDirection"] == SortDirection.Ascending) ?
                    SortDirection.Descending : SortDirection.Ascending;
            }
            // Apply the sort
            DataTable dataTable = HistoryGrid.DataSource as DataTable;

            dataTable.DefaultView.Sort = e.SortExpression +
                                         (string)((e.SortDirection == SortDirection.Ascending) ? " ASC" : " DESC");
            ViewState["SortColumn"]          = e.SortExpression;
            ViewState["SortColumnDirection"] = e.SortDirection;

            HistoryGrid.DataSource = dataTable;
            HistoryGrid.DataBind();
        }
Esempio n. 7
0
        /// <summary>
        /// Processes Page Load
        /// </summary>
        /// <param name="sender">Sending Object</param>
        /// <param name="e">Event Args</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            //Check For Logon Class
            if (HttpContext.Current.Session["LogonInfo"] != null)
            {
                //Get Logon Info From Session
                _oLogon = ((LogonObject)HttpContext.Current.Session["LogonInfo"]);

                //Add Use ID TO Session
                HttpContext.Current.Session.Add("UserID", _oLogon.UserID);

                //Load Form Permissions
                if (FormSetup(_oLogon.UserID))
                {
                    //Setup Buttons
                    Master.ShowSaveButton        = false;
                    Master.ShowNewButton         = false;
                    Master.ShowEditButton        = false;
                    Master.ShowDeleteButton      = false;
                    Master.ShowViewButton        = _userCanView;
                    Master.ShowCopyJobButton     = _userCanAdd;
                    Master.ShowPrintButton       = false;
                    Master.ShowPdfButton         = false;
                    Master.ShowXlsButton         = false;
                    Master.ShowMultiSelectButton = false;
                }
            }

            //Check For Post Back
            if (!IsPostBack)
            {
                //Bind Grid
                HistoryGrid.DataBind();
            }
            else
            {
                //Check Async
                var scriptManager = ScriptManager.GetCurrent(Page);
                if (scriptManager != null && scriptManager.IsInAsyncPostBack)
                {
                }

                //Get Control That Caused Post Back
                var controlName = Request.Params.Get("__EVENTTARGET");

                //Check For Null
                if (!string.IsNullOrEmpty(controlName))
                {
                    //Determing What To Do
                    switch (controlName.Replace("ctl00$Footer$", ""))
                    {
                    case "ViewButton":
                    {
                        //Call View Routine
                        ViewSelectedRow();
                        break;
                    }

                    case "PrintButton":
                    {
                        //Call Print Routine
                        PrintSelectedRow();
                        break;
                    }

                    case "ExportPDF":
                    {
                        //Call Export PDF Option
                        ExportPdf();
                        break;
                    }

                    case "ExportXLS":
                    {
                        //Call Export XLS Option
                        ExportXls();
                        break;
                    }

                    case "CopyJob":
                    {
                        //Call Copy Routine
                        CopyJobRoutine();

                        //break
                        break;
                    }

                    default:
                    {
                        //Do Nothing
                        break;
                    }
                    }
                }
            }

            //Enable/Disable Buttons
            Master.ShowViewButton    = !(HistoryGrid.Columns[0].Visible);
            Master.ShowPrintButton   = false;/*!(HistoryGrid.Columns[0].Visible);*/
            Master.ShowCopyJobButton = !(HistoryGrid.Columns[0].Visible);

            //Clear Prior Selection If Edit Check Is No Longer Visible
            if (!(HistoryGrid.Columns[0].Visible))
            {
                //Uncheck All
                HistoryGrid.Selection.UnselectAll();
            }
        }