Exemple #1
0
        private void SetupDropdown()
        {
            var isTesting = SessionVariables.IsTesting;
            var layerData = LayerDataManager.GetList(SessionVariables.RequestProfile);

            UIHelper.LoadDropDown(layerData, drpLayerList, StandardDataModel.StandardDataColumns.Name, LayerDataModel.DataColumns.LayerId);

            if (isTesting)
            {
                drpLayerList.AutoPostBack = true;
                if (drpLayerList.Items.Count > 0)
                {
                    if (!string.IsNullOrEmpty(txtLayerId.Text.Trim()))
                    {
                        drpLayerList.SelectedValue = txtLayerId.Text;
                    }
                    else
                    {
                        txtLayerId.Text = drpLayerList.SelectedItem.Value;
                    }
                }
                txtLayerId.Visible = true;
            }
            else
            {
                if (!string.IsNullOrEmpty(txtLayerId.Text.Trim()))
                {
                    drpLayerList.SelectedValue = txtLayerId.Text;
                }
            }
        }
Exemple #2
0
        protected override DataTable UpdateData()
        {
            var UpdatedData = new DataTable();

            var data = new LayerDataModel();

            UpdatedData = LayerDataManager.Search(data, SessionVariables.RequestProfile).Clone();
            for (var i = 0; i < SelectedData.Rows.Count; i++)
            {
                data.LayerId =
                    Convert.ToInt32(SelectedData.Rows[i][LayerDataModel.DataColumns.LayerId].ToString());
                data.Name        = SelectedData.Rows[i][StandardDataModel.StandardDataColumns.Name].ToString();
                data.Description =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.Description))
                                        ? CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.Description)
                                        : SelectedData.Rows[i][StandardDataModel.StandardDataColumns.Description].ToString();

                data.SortOrder =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.SortOrder))
                                        ? int.Parse(CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.SortOrder).ToString())
                                        : int.Parse(SelectedData.Rows[i][StandardDataModel.StandardDataColumns.SortOrder].ToString());

                LayerDataManager.Update(data, SessionVariables.RequestProfile);
                data         = new LayerDataModel();
                data.LayerId = Convert.ToInt32(SelectedData.Rows[i][LayerDataModel.DataColumns.LayerId].ToString());
                var dt = LayerDataManager.Search(data, SessionVariables.RequestProfile);

                if (dt.Rows.Count == 1)
                {
                    UpdatedData.ImportRow(dt.Rows[0]);
                }
            }
            return(UpdatedData);
        }
Exemple #3
0
        public void LoadData(int layerId, bool showId)
        {
            Clear();

            var data = new LayerDataModel();

            data.LayerId = layerId;

            var items = LayerDataManager.GetEntityDetails(data, SessionVariables.RequestProfile);

            if (items.Count != 1)
            {
                return;
            }

            var item = items[0];

            SetData(item);

            if (!showId)
            {
                SystemKeyId = item.LayerId;
                oHistoryList.Setup(PrimaryEntity, layerId, PrimaryEntityKey);
            }
            else
            {
                CoreSystemKey.Text = String.Empty;
            }
        }
Exemple #4
0
        private System.Data.DataTable GetData()
        {
            var data = new LayerDataModel();
            var dt   = LayerDataManager.Search(data, SessionVariables.RequestProfile);

            return(dt);
        }
Exemple #5
0
        public override int?Save(string action)
        {
            var data = new LayerDataModel();

            data.LayerId     = SystemKeyId;
            data.Name        = Name;
            data.Description = Description;
            data.SortOrder   = SortOrder;

            if (action == "Insert")
            {
                var dtLayer = LayerDataManager.DoesExist(data, SessionVariables.RequestProfile);

                if (dtLayer.Rows.Count == 0)
                {
                    LayerDataManager.Create(data, SessionVariables.RequestProfile);
                }
                else
                {
                    throw new Exception("Record with given ID already exists.");
                }
            }
            else
            {
                LayerDataManager.Update(data, SessionVariables.RequestProfile);
            }

            return(data.LayerId);
        }
Exemple #6
0
        protected override DataTable GetEntityData(int?entityKey)
        {
            var layerdata = new LayerDataModel();

            layerdata.LayerId = entityKey;
            var results = LayerDataManager.Search(layerdata, SessionVariables.RequestProfile);

            return(results);
        }
Exemple #7
0
        protected override void Update(Dictionary <string, string> values)
        {
            var data = new LayerDataModel();

            // copies properties from values dictionary object to data object
            PropertyMapper.CopyProperties(data, values);

            LayerDataManager.Update(data, SessionVariables.RequestProfile);
            base.Update(values);
        }
Exemple #8
0
        private void UpdateData(ArrayList values)
        {
            var data = new LayerDataModel();

            data.LayerId     = int.Parse(values[0].ToString());
            data.Name        = values[1].ToString();
            data.Description = values[2].ToString();
            data.SortOrder   = int.Parse(values[3].ToString());
            LayerDataManager.Update(data, SessionVariables.RequestProfile);
            ReBindEditableGrid();
        }
Exemple #9
0
        public override void LoadDropDownListSources(string fieldName, DropDownList dropDownListControl)
        {
            base.LoadDropDownListSources(fieldName, dropDownListControl);

            if (fieldName.Equals("LayerId"))
            {
                var layerData = LayerDataManager.GetList(SessionVariables.RequestProfile);
                UIHelper.LoadDropDown(layerData, dropDownListControl, StandardDataModel.StandardDataColumns.Name, LayerDataModel.DataColumns.LayerId);
            }

            if (fieldName.Equals("GroupBy") || fieldName.Equals("SubGroupBy"))
            {
            }
        }
Exemple #10
0
        private int GetNextValidId(int tempId)
        {
            var dt = LayerDataManager.GetList(SessionVariables.RequestProfile);

            foreach (DataRow dr in dt.Rows)
            {
                if (dr[LayerDataModel.DataColumns.LayerId].ToString().Equals(tempId.ToString()))
                {
                    tempId -= 1;
                    return(GetNextValidId(tempId));
                }
            }

            return(tempId);
        }
Exemple #11
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         string[] deleteIndexList = DeleteIds.Split(',');
         foreach (string index in deleteIndexList)
         {
             var data = new LayerDataModel();
             data.LayerId = int.Parse(index);
             LayerDataManager.Delete(data, SessionVariables.RequestProfile);
             DeleteAndRedirect();
         }
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message);
     }
 }
Exemple #12
0
        protected override DataTable GetData()
        {
            try
            {
                SuperKey = ApplicationCommon.GetSuperKey();
                SetId    = ApplicationCommon.GetSetId();

                var selectedrows = new DataTable();
                var layerdata    = new LayerDataModel();

                selectedrows = LayerDataManager.GetDetails(layerdata, SessionVariables.RequestProfile).Clone();
                if (!string.IsNullOrEmpty(SuperKey))
                {
                    var systemEntityTypeId = (int)PrimaryEntity;
                    var lstEntityKeys      = ApplicationCommon.GetSuperKeyDetails(systemEntityTypeId, SuperKey);

                    foreach (var entityKey in lstEntityKeys)
                    {
                        layerdata.LayerId = entityKey;
                        var result = LayerDataManager.GetDetails(layerdata, SessionVariables.RequestProfile);
                        selectedrows.ImportRow(result.Rows[0]);
                    }
                }
                else
                {
                    layerdata.LayerId = SetId;
                    var result = LayerDataManager.GetDetails(layerdata, SessionVariables.RequestProfile);
                    selectedrows.ImportRow(result.Rows[0]);
                }
                return(selectedrows);
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }

            return(null);
        }
Exemple #13
0
        protected override void ShowData(int layerId)
        {
            base.ShowData(layerId);

            oDetailButtonPanel.SetId = SetId;

            Clear();

            var data = new LayerDataModel();

            data.LayerId = layerId;

            var items = LayerDataManager.GetEntityDetails(data, SessionVariables.RequestProfile);

            if (items.Count == 1)
            {
                var item = items[0];

                SetData(item);

                oHistoryList.Setup(PrimaryEntity, layerId, "Layer");
            }
        }
Exemple #14
0
        protected override void OnInit(EventArgs e)
        {
            try
            {
                var superKey      = "";
                var newId         = Framework.Components.Core.SystemEntityTypeDataManager.GetNextSequence("Layer", (int)Framework.Components.DataAccess.SystemEntity.Layer, SessionVariables.RequestProfile);
                var Layerdata     = new LayerDataModel();
                var systemdevdata = new SystemDevNumbersDataModel();
                systemdevdata.ApplicationUserId = SessionVariables.RequestProfile.AuditId;
                var dtnumbers = Framework.Components.Core.SystemDevNumbersDataManager.Search(systemdevdata, SessionVariables.RequestProfile);
                var rangefrom =
                    Convert.ToInt32(dtnumbers.Rows[0][SystemDevNumbersDataModel.DataColumns.RangeFrom].ToString());
                var rangeto =
                    Convert.ToInt32(dtnumbers.Rows[0][SystemDevNumbersDataModel.DataColumns.RangeTo].ToString());
                if (Request.QueryString["SuperKey"] != null)
                {
                    superKey = Request.QueryString["SuperKey"].ToString();
                    var data = new SuperKeyDetailDataModel();
                    data.SuperKeyId         = Convert.ToInt32(superKey);
                    data.SystemEntityTypeId = (int)Framework.Components.DataAccess.SystemEntity.Layer;
                    var dt = Framework.Components.Core.SuperKeyDetailDataManager.Search(data, SessionVariables.RequestProfile);

                    if (dt != null && dt.Rows.Count > 0)
                    {
                        foreach (System.Data.DataRow dr in dt.Rows)
                        {
                            var key = Convert.ToInt32(dr[SuperKeyDetailDataModel.DataColumns.EntityKey]);
                            Layerdata.LayerId = key;

                            var Layerdt = LayerDataManager.GetDetails(Layerdata, SessionVariables.RequestProfile);

                            if (Layerdt.Rows.Count == 1)
                            {
                                var row = Layerdt.Rows[0];

                                if (Request.QueryString["Mode"].ToString().Equals("Test"))
                                {
                                    Layerdata.LayerId = GetNextValidId(rangefrom);
                                }
                                Layerdata.Name        = Convert.ToString(row[StandardDataModel.StandardDataColumns.Name]);
                                Layerdata.Description = Convert.ToString(row[StandardDataModel.StandardDataColumns.Description]);
                                Layerdata.SortOrder   = Convert.ToInt32(row[StandardDataModel.StandardDataColumns.SortOrder]);

                                LayerDataManager.Create(Layerdata, SessionVariables.RequestProfile);
                            }
                        }
                    }
                }
                else if (Request.QueryString["SetId"] != null)
                {
                    var key = int.Parse(Request.QueryString["SetId"]);
                    Layerdata.LayerId = key;

                    var Layerdt = LayerDataManager.GetDetails(Layerdata, SessionVariables.RequestProfile);

                    if (Layerdt.Rows.Count == 1)
                    {
                        var row = Layerdt.Rows[0];

                        var newLayerdata = new LayerDataModel();
                        if (Request.QueryString["Mode"].ToString().Equals("Test"))
                        {
                            newLayerdata.LayerId = newId = (int)GetNextValidId(rangefrom);
                        }
                        newLayerdata.Name        = Convert.ToString(row[StandardDataModel.StandardDataColumns.Name]);
                        newLayerdata.Description = Convert.ToString(row[StandardDataModel.StandardDataColumns.Description]);
                        newLayerdata.SortOrder   = Convert.ToInt32(row[StandardDataModel.StandardDataColumns.SortOrder]);

                        UpdatedFKDepenedencies(key, newId);
                        LayerDataManager.Delete(Layerdata, SessionVariables.RequestProfile);
                        LayerDataManager.Create(newLayerdata, SessionVariables.RequestProfile);
                    }
                }
                else if (Request.QueryString["Mode"].ToString().Equals("Renumber"))
                {
                    var seed = int.Parse(Request.QueryString["Seed"].ToString());
                    //ApplicationVariables.Seed;
                    var increment = int.Parse(Request.QueryString["Increment"].ToString());
                    //ApplicationVariables.Increment;
                    LayerDataManager.Renumber(seed, increment, SessionVariables.RequestProfile);
                }
                base.OnInit(e);

                Response.Redirect("Default.aspx?Added=true", false);
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
Exemple #15
0
        protected override DataTable GetData()
        {
            var dt = LayerDataManager.Search(oSearchFilter.SearchParameters, SessionVariables.RequestProfile);

            return(dt);
        }
Exemple #16
0
 private void ReBindEditableGrid()
 {
     var data    = new LayerDataModel();
     var dtLayer = LayerDataManager.Search(data, SessionVariables.RequestProfile);
 }