Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //SqlConnection con = new SqlConnection("Data Source=asktoakhi.database.windows.net;Initial Catalog=asktoakhi;UID=asktoakhi;pwd=@K#!le47;Max Pool Size=100000;");
            SqlConnection  con = new SqlConnection("Data Source=.;database=jaspreet;integrated security=SSPI;");
            SqlCommand     cmd;
            SqlDataAdapter da = new SqlDataAdapter();
            DataTable      dt = new DataTable();

            try
            {
                con.Open();
                string Query = "SELECT * FROM jaspreet WHERE UserName =  '******'";
                cmd = new SqlCommand(Query, con);
                da.SelectCommand = cmd;
                da.Fill(dt);

                if (dt.Rows.Count > 0)
                {
                    GridProfile.DataSource = dt;
                    GridProfile.DataBind();
                }
                else
                {
                    Response.Write("<Script>alert('No Record Found.');</Script>");
                }
            }
            catch (Exception ex)
            {
                Response.Write("<Script>alert('" + ex.Message.ToString() + "');</Script>");
            }
            finally
            {
                con.Close();
            }
        }
Пример #2
0
        public override void Start()
        {
            GridProfile branch = (GridProfile)SourceFeature;

            TargetFeature = new GridProfile
            {
                Geometry = ((IGeometry)branch.Geometry.Clone()),
            };
        }
Пример #3
0
        public bool CreateProfile(SearchViewModel model, string profileName, string currentUserEmail)
        {
            using (var context = new BaseContext())
            {
                var user = context.Users
                           .Include(u => u.GridProfiles.Select(g => g.DGrid))
                           .FirstOrDefault(u => u.Email
                                           .Equals(currentUserEmail));

                var profiles = context
                               .GridProfiles
                               .Where(g =>
                                      g.ProfileName
                                      .Equals(profileName) &&
                                      g.UserId
                                      .Equals(user.Id) &&
                                      g.DGrid.Type
                                      .Equals(GridType));

                if (!profiles.Any() && user.Id > 0)
                {
                    var receivedFields = Mapper.Map <List <GridField> >(model.Columns);
                    var profile        = new GridProfile
                    {
                        GridFields  = receivedFields,
                        IsDefault   = true,
                        SearchField = model.Field,
                        SearchValue = model.SearchValue,
                        ProfileName = profileName,
                        UserId      = user.Id
                    };

                    var leadsGrid = user
                                    .GridProfiles
                                    .FirstOrDefault(g => g.DGrid.Type.Equals(GridType))
                                    ?.DGrid;

                    if (leadsGrid != null)
                    {
                        foreach (var item in leadsGrid.GridProfiles)
                        {
                            item.IsDefault = false;
                        }

                        leadsGrid.GridProfiles.Add(profile);
                    }
                    else
                    {
                        context.DGrids.Add(new DGrid {
                            Type = GridType, GridProfiles = new List <GridProfile> {
                                profile
                            }
                        });
                    }

                    context.SaveChanges();

                    return(true);
                }
            }

            return(false);
        }
Пример #4
0
 protected void AutoRefreshTimer_Tick(object sender, EventArgs e)
 {
     GridProfile.DataBind();
 }