Example #1
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.PreRender" /> event.
        /// </summary>
        /// <param name="e">An <see cref="T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            if (DisplayMode == ViewMode.InventoryManager)
            {
                gvBookings.MasterTableView.GetColumn("BookingNumber").Visible = true;
            }
            else if (DisplayMode == ViewMode.MyBookings)
            {
                gvBookings.MasterTableView.GetColumn("BookingNumber").Visible = false;
            }

            if (gvBookings.MasterTableView.GetItems(GridItemType.NoRecordsItem).Length > 0)
            {
                GridNoRecordsItem norecordItem = (GridNoRecordsItem)gvBookings.MasterTableView.GetItems(GridItemType.NoRecordsItem)[0];
                Label             lblNoData    = (Label)norecordItem.FindControl("lblNoData");
                if (lblNoData != null)
                {
                    if (!IsPostBack)
                    {
                        lblNoData.Text = "When you create a basic booking list or book Items to a Project you can access the details from here.";
                    }
                    else
                    {
                        lblNoData.Text = "No Data";
                    }
                }
            }
        }
Example #2
0
        /// <summary>
        /// Loads the user activities.
        /// </summary>
        /// <param name="selectedDate">The selected date.</param>
        private void LoadUserActivities(DateTime selectedDate)
        {
            DateTime startDate = new DateTime(selectedDate.Year, selectedDate.Month, 1);
            DateTime endDate   = new DateTime(selectedDate.Year, selectedDate.Month, DateTime.DaysInMonth(selectedDate.Year, selectedDate.Month));

            try
            {
                bool isAscending = SortOrder == GridSortOrder.Ascending ? true : false;
                int  totalRecords;
                int  pageSize         = gvUserActivity.MasterTableView.PageSize;
                var  userActivityList = GetBL <PersonalBL>().GetUserActivitiesFromGoogleAnalytics(ViewUserId, startDate, endDate, pageSize, PageIndex, SortField, isAscending, out totalRecords);
                gvUserActivity.VirtualItemCount = totalRecords;
                gvUserActivity.DataSource       = userActivityList;
            }
            catch (StageBitzException ex)
            {
                gvUserActivity.DataSource = string.Empty;
                gvUserActivity.Rebind();

                GridNoRecordsItem norecordItem = (GridNoRecordsItem)gvUserActivity.MasterTableView.GetItems(GridItemType.NoRecordsItem)[0];
                Label             lblNoData    = (Label)norecordItem.FindControl("lblNoData");
                Label             lblError     = (Label)norecordItem.FindControl("lblError");

                lblNoData.Visible = false;
                lblError.Visible  = true;
                lblError.Text     = ex.InnerException.ToString();
            }
        }
Example #3
0
    protected void RadGridBoxes_ItemCreated(object sender, GridItemEventArgs e)
    {
        CheckSession();
        try
        {
            string po_id = getPoID();

            if (e.Item is GridNoRecordsItem)
            {
                GridNoRecordsItem item = (GridNoRecordsItem)e.Item;
                //GridNoRecordsItem item = (GridNoRecordsItem)RadGridBoxes.MasterTableView.GetItems(GridItemType.NoRecordsItem)[0];
                TextBox   tldd_employeNbrTXT  = (TextBox)item.FindControl("tldd_employeNbrTXT");
                TextBox   tldd_employeNameTXT = (TextBox)item.FindControl("tldd_employeNameTXT");
                RadButton noRecEditBTN        = (RadButton)item.FindControl("noRecEditBTN");

                string tldh_id;
                try
                {
                    GridDataItem parentItem = e.Item.OwnerTableView.ParentItem;
                    tldh_id = parentItem.GetDataKeyValue("tldh_id").ToString();
                }
                catch (Exception ex)
                {
                    return;
                }
                using (SqlConnection con = new SqlConnection(Controller.connection))
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        con.Open();
                        DataTable dt = new DataTable();

                        cmd.CommandText = "select * from View_TLDHeaderDetails where active = @active and tldh_id = @tldh_id and tldhd_name = @tldhd_name and po_id = @po_id;";
                        cmd.Parameters.AddWithValue("active", true.ToString());
                        cmd.Parameters.AddWithValue("tldhd_name", "");
                        cmd.Parameters.AddWithValue("tldh_id", tldh_id);
                        cmd.Parameters.AddWithValue("po_id", po_id);
                        cmd.Connection  = con;
                        cmd.CommandType = CommandType.Text;
                        SqlDataAdapter sda = new SqlDataAdapter();
                        sda.SelectCommand = cmd;
                        sda.Fill(dt);

                        if (dt.Rows.Count > 0)
                        {
                            tldd_employeNbrTXT.Text  = dt.Rows[0]["tldd_employeNbr"].ToString();
                            tldd_employeNameTXT.Text = dt.Rows[0]["tldd_employeName"].ToString();

                            if (Boolean.Parse(dt.Rows[0]["po_sendIt"].ToString()) == true)
                            {
                                noRecEditBTN.Visible = false;
                            }
                        }
                    }
                }
            }

            else if ((e.Item is GridDataItem))
            {
                GridDataItem item = (GridDataItem)e.Item;

                TextBox tldd_employeNbrTXT  = (TextBox)item.FindControl("tldd_employeNbrTXT");
                TextBox tldd_employeNameTXT = (TextBox)item.FindControl("tldd_employeNameTXT");
                Label   tldd_idLBL          = (Label)item.FindControl("tldd_idLBL");
                string  tldhd_id;

                try {
                    tldhd_id = item.GetDataKeyValue("tldhd_id").ToString();
                }
                catch (Exception ex)
                {
                    return;
                }

                using (SqlConnection con = new SqlConnection(Controller.connection))
                {
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        con.Open();
                        DataTable dt = new DataTable();

                        cmd.CommandText = "select * from CNRS_TLDDetails where active = @active and tldhd_id = @tldhd_id and po_id = @po_id;";
                        cmd.Parameters.AddWithValue("active", true.ToString());
                        cmd.Parameters.AddWithValue("tldhd_id", tldhd_id);
                        cmd.Parameters.AddWithValue("po_id", po_id);
                        cmd.Connection  = con;
                        cmd.CommandType = CommandType.Text;
                        SqlDataAdapter sda = new SqlDataAdapter();
                        sda.SelectCommand = cmd;
                        sda.Fill(dt);

                        if (dt.Rows.Count > 0)
                        {
                            tldd_employeNbrTXT.Text  = dt.Rows[0]["tldd_employeNbr"].ToString();
                            tldd_employeNameTXT.Text = dt.Rows[0]["tldd_employeName"].ToString();
                            tldd_idLBL.Text          = dt.Rows[0]["tldd_id"].ToString();
                        }
                    }
                }
            }
        }
        catch (Exception ex)
        {
            Controller.SaveErrors(Path.GetFileName(Request.PhysicalPath), ex.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name);
        }
    }
Example #4
0
    //***

    protected void NoRecordsEdit_Click(object sender, EventArgs e)
    {
        try
        {
            string po_id = getPoID();

            RadButton         ibtn       = (RadButton)sender;
            GridNoRecordsItem item       = (GridNoRecordsItem)ibtn.NamingContainer;
            GridDataItem      parentItem = (GridDataItem)item.OwnerTableView.ParentItem;
            string            tldh_id    = parentItem.GetDataKeyValue("tldh_id").ToString();

            TextBox tldd_employeNbr  = (TextBox)item.FindControl("tldd_employeNbrTXT");
            TextBox tldd_employeName = (TextBox)item.FindControl("tldd_employeNameTXT");

            using (SqlConnection con = new SqlConnection(Controller.connection))
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    Dictionary <string, string> fields     = new Dictionary <string, string>();
                    Dictionary <string, string> conditions = new Dictionary <string, string>();
                    conditions.Add("active", true.ToString());
                    conditions.Add("tldhd_name", "");
                    conditions.Add("tldh_id", tldh_id);
                    conditions.Add("po_id", po_id);

                    con.Open();
                    DataTable dt = Controller.SelectFrom(cmd, con, "View_TLDHeaderDetails", new ArrayList(), conditions, new ArrayList(), true, false, "");

                    fields.Clear();
                    fields.Add("tldd_employeNbr", tldd_employeNbr.Text);
                    fields.Add("tldd_employeName", tldd_employeName.Text);

                    if (dt.Rows.Count > 0)   // if exist this row
                    {
                        conditions.Clear();
                        conditions.Add("tldd_id", dt.Rows[0]["tldd_id"].ToString());
                        fields.Add("modifedBy", Session["user_name"].ToString());
                        fields.Add("modifiedOn", DateTime.Now.ToString());
                        Controller.Update(cmd, con, "CNRS_TLDDetails", fields, conditions);
                    }
                    else
                    {
                        ArrayList field = new ArrayList();
                        field.Add("tldhd_id");
                        conditions.Clear();
                        conditions.Add("tldhd_name", "");
                        conditions.Add("tldh_id", tldh_id);
                        DataTable dt1      = Controller.SelectFrom(cmd, con, "CNRS_TLDHeaderDetails", field, conditions, new ArrayList(), false, false, "");
                        string    tldhd_id = dt1.Rows[0]["tldhd_id"].ToString();

                        fields.Add("createdBy", Session["user_name"].ToString());
                        fields.Add("tldhd_id", tldhd_id);
                        fields.Add("po_id", po_id);
                        Controller.InsertInto(cmd, con, "CNRS_TLDDetails", fields, false);
                    }

                    AlertJS();
                }
            }
        }
        catch (Exception ex)
        {
            Controller.SaveErrors(Path.GetFileName(Request.PhysicalPath), ex.Message, System.Reflection.MethodInfo.GetCurrentMethod().Name);
        }
    }