Exemplo n.º 1
0
    protected void LnkOtherApp_Click(object sender, EventArgs e)
    {
        GrdHistory.DataSource = null;
        GrdHistory.DataBind();

        LnkOtherApp.Visible         = false;
        LblCount.Text               = "Axtarış üzrə: 0      Səhifə üzrə: 0";
        LnkOtherApp.CommandArgument = (int.Parse(LnkOtherApp.CommandArgument) + 20)._ToString();

        Dictionary <string, object> DictHistory = new Dictionary <string, object>();

        DictHistory.Add("AdoptionAdministratorsID", int.Parse(DListUsersName.SelectedValue));

        DALC.DataTableResult AdoptionAdministratorHistory = DALC_Adoption.GetAdoptionAdministratorHistory(int.Parse(LnkOtherApp.CommandArgument), DictHistory, "");

        if (AdoptionAdministratorHistory.Count == -1)
        {
            Config.MsgBoxAjax(Config._DefaultSystemErrorMessages, Page);
            return;
        }

        GrdHistory.DataSource = AdoptionAdministratorHistory.Dt;
        GrdHistory.DataBind();

        LblCount.Text = "Axtarış üzrə: " + AdoptionAdministratorHistory.Count + "      Səhifə üzrə: " + GrdHistory.Rows.Count._ToString();

        if (AdoptionAdministratorHistory.Dt.Rows.Count > 0)
        {
            LnkOtherApp.Visible = (GrdHistory.Rows.Count < AdoptionAdministratorHistory.Count);
        }

        BtnSearch.CommandArgument = "";
    }
Exemplo n.º 2
0
    protected void LnkOtherApp_Click(object sender, EventArgs e)
    {
        GrdHistory.DataSource = null;
        GrdHistory.DataBind();

        LnkOtherApp.Visible         = false;
        LnkOtherApp.CommandArgument = (int.Parse(LnkOtherApp.CommandArgument) + 20)._ToString();

        bool Cache = true;

        // Əgər filter olunubsa Cache-de saxlamayaq
        if (BtnSearch.CommandArgument == "1")
        {
            Cache = false;
        }

        DALC.DataTableResult HistoryTypes = DALC.GetHistory(LnkOtherApp.CommandArgument, DListOrganization.SelectedValue, DListUsersName.SelectedValue, DListHistoryTypes.SelectedValue, DListPermissionsType.SelectedValue, PersonsID.IsEmptyReplaceNoul("-1"), Cache);

        if (HistoryTypes.Count == -1)
        {
            Config.MsgBoxAjax(Config._DefaultSystemErrorMessages, Page);
            return;
        }

        GrdHistory.DataSource = HistoryTypes.Dt;
        GrdHistory.DataBind();

        if (HistoryTypes.Dt.Rows.Count > 0)
        {
            LnkOtherApp.Visible = (GrdHistory.Rows.Count < HistoryTypes.Count);
        }

        BtnSearch.CommandArgument = "";
    }
Exemplo n.º 3
0
    protected void LnkOtherApp_Click(object sender, EventArgs e)
    {
        GrdList.DataSource = null;
        GrdList.DataBind();

        LnkOtherApp.Visible         = false;
        LblCount.Text               = "Axtarış üzrə: 0      Səhifə üzrə: 0";
        LnkOtherApp.CommandArgument = (int.Parse(LnkOtherApp.CommandArgument) + 20)._ToString();


        Dictionary <string, object> Dictionary = new Dictionary <string, object>()
        {
            { "Username(LIKE)", TxtFilterUsername.Text },
            { "Fullname(LIKE)", TxtFilterFullname.Text.Replace("i", "İ").Replace("ı", "I").ToUpper() },
            { "IsActive", int.Parse(DListFilterStatus.SelectedValue) }
        };

        DALC.DataTableResult AdoptionAdministrators = DALC_Adoption.GetAdoptionAdministrator(int.Parse(LnkOtherApp.CommandArgument), Dictionary, "");

        if (AdoptionAdministrators.Count == -1)
        {
            Config.MsgBoxAjax(Config._DefaultSystemErrorMessages, Page);
            return;
        }

        GrdList.DataSource = AdoptionAdministrators.Dt;
        GrdList.DataBind();

        LblCount.Text = "Axtarış üzrə: " + AdoptionAdministrators.Count + "      Səhifə üzrə: " + GrdList.Rows.Count._ToString();

        if (AdoptionAdministrators.Dt.Rows.Count > 0)
        {
            LnkOtherApp.Visible = (GrdList.Rows.Count < AdoptionAdministrators.Count);
        }
    }
Exemplo n.º 4
0
    private void BindGrid()
    {
        GrdDownloads.DataSource = null;
        GrdDownloads.DataBind();

        PnlSearch.BindControls(FilterDictionary, TableName);

        FilterDictionary = new Dictionary <string, object>()
        {
            { "DownloadsTypesID", DListFilterDownloadsTypes.SelectedValue },
            { "DisplayName(LIKE)", TxtFilterFileName.Text },
            { "IsActive", int.Parse(DListFilterStatus.SelectedValue) },
        };


        int PageNum;
        int RowNumber = 20;

        if (!int.TryParse(Config._GetQueryString("p"), out PageNum))
        {
            PageNum = 1;
        }


        HdnPageNumber.Value = PageNum.ToString();

        DALC.DataTableResult FilterList = DALC.GetFilterList(TableName, FilterDictionary, PageNum, RowNumber);

        if (FilterList.Count == -1)
        {
            return;
        }

        if (FilterList.Dt.Rows.Count < 1 && PageNum > 1)
        {
            Config.RedirectURL(string.Format("/tools/downloads/?p={0}", PageNum - 1));
        }

        LblCount.Text = string.Format(LblCount.Text, FilterList.Count);

        int Total_Count = 0;

        if (FilterList.Count % RowNumber > 0)
        {
            Total_Count = (FilterList.Count / RowNumber) + 1;
        }
        else
        {
            Total_Count = FilterList.Count / RowNumber;
        }

        HdnTotalCount.Value = Total_Count.ToString();
        PnlPager.Visible    = FilterList.Count > RowNumber;

        GrdDownloads.DataSource = FilterList.Dt;
        GrdDownloads.DataBind();

        GrdDownloads.Columns[GrdDownloads.Columns.Count - 1].Visible = DALC._GetUsersLogin.OrganizationsParentID == 0;
    }
Exemplo n.º 5
0
    void BindGrid()
    {
        GrdOrganizations.DataSource = null;
        GrdOrganizations.DataBind();

        if (Session[_FilterSessionName] != null)
        {
            var DictionarySession = (Dictionary <string, object>)Session[_FilterSessionName];
            if (DictionarySession.Count != 0)
            {
                DListTopOrganizationFilter.SelectedValue = DictionarySession["ParentID"]._ToString();
                TxtNameFilter.Text = DictionarySession["Name(LIKE)"]._ToString();
            }
        }

        var Dictionary = new Dictionary <string, object>()
        {
            { "ParentID", DListTopOrganizationFilter.SelectedValue },
            { "Name(LIKE)", TxtNameFilter.Text },
        };


        int PageNum;
        int RowNumber = 20;

        if (!int.TryParse(Config._GetQueryString("p"), out PageNum))
        {
            PageNum = 1;
        }

        // Axirinci sehifeni secmedikce Cache temizlemirik herdefe count almasin deye
        if (PageNum >= (Cache[_CountCacheName]._ToInt32() / RowNumber))
        {
            Cache.Remove(_CountCacheName);
        }

        HdnPageNumber.Value = PageNum.ToString();

        DALC.DataTableResult PersonsList = DALC.GetOrganizationsList(Dictionary, PageNum, RowNumber);

        if (PersonsList.Count == -1)
        {
            return;
        }

        if (PersonsList.Dt.Rows.Count < 1 && PageNum > 1)
        {
            Config.RedirectURL(string.Format("/tools/datalist/?p={0}", PageNum - 1));
        }

        int Total_Count = PersonsList.Count % RowNumber > 0 ? (PersonsList.Count / RowNumber) + 1 : PersonsList.Count / RowNumber;

        HdnTotalCount.Value = Total_Count.ToString();

        PnlPager.Visible            = PersonsList.Count > RowNumber;
        GrdOrganizations.DataSource = PersonsList.Dt;
        GrdOrganizations.DataBind();
    }
Exemplo n.º 6
0
    private void BindGridApplications()
    {
        GrdApplicationsFamily.DataSource = null;
        GrdApplicationsFamily.DataBind();

        PnlSearch.BindControls(FilterDictionary, TableName);

        FilterDictionary = new Dictionary <string, object>()
        {
            { "OrganizationsID", int.Parse(DListFltOrganizations.SelectedValue) },
            { "ID", TxtApplicationsFamilyID.Text },
            { "ApplicationsFamilyTypesID", int.Parse(DListFltApplicationsFamilyTypes.SelectedValue) },
            { "ApplicationsFamilyStatusID", int.Parse(DListFltApplicationsFamilyStatus.SelectedValue) },
            { "Tour_Dt(BETWEEN)", Config.DateTimeFilter(TxtFilterTourDt1.Text, TxtFilterTourDt2.Text) },
            { "Add_Dt(Between)", Config.DateTimeFilter(TxtFilterDate1.Text, TxtFilterDate2.Text) },
        };

        int PageNum;
        int RowNumber = 20;

        if (!int.TryParse(Config._GetQueryString("p"), out PageNum))
        {
            PageNum = 1;
        }

        HdnPageNumber.Value = PageNum.ToString();

        DALC.DataTableResult FilterList = DALC.GetFilterList(TableName, FilterDictionary, PageNum, RowNumber);

        if (FilterList.Count == -1)
        {
            return;
        }

        if (FilterList.Dt.Rows.Count < 1 && PageNum > 1)
        {
            Config.RedirectURL(string.Format("/tools/applicationsfamily/?p={0}", PageNum - 1));
        }

        LblCount.Text = string.Format("Axtarış üzrə nəticə: {0}", FilterList.Count);

        int Total_Count = 0;

        if (FilterList.Count % RowNumber > 0)
        {
            Total_Count = (FilterList.Count / RowNumber) + 1;
        }
        else
        {
            Total_Count = FilterList.Count / RowNumber;
        }

        HdnTotalCount.Value = Total_Count.ToString();
        PnlPager.Visible    = FilterList.Count > RowNumber;
        GrdApplicationsFamily.DataSource = FilterList.Dt;
        GrdApplicationsFamily.DataBind();
    }
Exemplo n.º 7
0
    private void BindNeeders()
    {
        GrdAdoptionPersonsList.DataSource = null;
        GrdAdoptionPersonsList.DataBind();

        PnlFilter.BindControls(FilterDictionary, _TableName);
        DListStatusType_SelectedIndexChanged(null, null);
        FilterDictionary = new Dictionary <string, object>()
        {
            { "Ap.ID", TxtID.Text },
            { "CONCAT(Soyad,' ',Ad,' ',Ata)(LIKE)", TxtFullname.Text },
            { "IsWebPreview", DListIsWebPreview.SelectedValue },
            { "IsBrotherSister", DListIsBrotherSister.SelectedValue },
            { "AdoptionPersonsStatusID", int.Parse(AdoptionPersonsStatusID) }
        };

        if (DListStatusType.SelectedIndex == 0)
        {
            FilterDictionary.Add("AdoptionPersonsStatusID(NOTIN)", 90);
        }

        int PageNum;
        int RowNumber = 16;

        if (!int.TryParse(Config._GetQueryString("pn"), out PageNum))
        {
            PageNum = 1;
        }

        HdnPageNumber.Value = PageNum.ToString();

        DALC.DataTableResult AdoptionPersonsResult = DALC_Adoption.GetAdoptionPersons(FilterDictionary, PageNum, RowNumber);

        if (AdoptionPersonsResult.Count == -1)
        {
            return;
        }

        if (AdoptionPersonsResult.Dt.Rows.Count < 1 && PageNum > 1)
        {
            Config.Redirect(string.Format("/adoptionadminn/tools/?p=adoptionpersons&pn={0}", PageNum - 1));
        }

        LblCount.Text = string.Format("Axtarış üzrə nəticə: {0}", AdoptionPersonsResult.Count.ToString());

        int Total_Count = AdoptionPersonsResult.Count % RowNumber > 0 ? (AdoptionPersonsResult.Count / RowNumber) + 1 : AdoptionPersonsResult.Count / RowNumber;

        HdnTotalCount.Value = Total_Count.ToString();

        PnlPager.Visible = AdoptionPersonsResult.Count > RowNumber;

        GrdAdoptionPersonsList.DataSource = AdoptionPersonsResult.Dt;
        GrdAdoptionPersonsList.DataBind();
    }
Exemplo n.º 8
0
    private void BindUsers()
    {
        rptUsers.DataSource = null;
        rptUsers.DataBind();

        pnlFilter.ControlsBind(filterDictionary, tableName);

        int usersId;

        int.TryParse(txtUsersId.Text, out usersId);
        if (usersId == 0)
        {
            usersId = -1;
        }

        filterDictionary = new Dictionary <string, object>()
        {
            { "Id", usersId },
            { "OrganizationsId", DALCL._Login.organizationsId },
            { "UsersSocialStatusLangsId", (int)Tools.Langs.AZ },
            { "UsersSocialStatusId", int.Parse(dListSocialStatus.SelectedValue) },
            { "UsersGendersLangsId", (int)Tools.Langs.AZ },
        };

        int pageNumber;
        int rowNumber = 50;

        if (!int.TryParse(ConfigL._Route("pagenum", "1"), out pageNumber))
        {
            pageNumber = 1;
        }

        hdnPageNumber.Value = pageNumber.ToString();

        DALC.DataTableResult usersResult = DALC.GetFilterList(tableName, filterDictionary, pageNumber, rowNumber);

        if (usersResult.Count == -1)
        {
            return;
        }

        lblCount.Text = $"Axtarış üzrə nəticə: {usersResult.Count.ToString()}";

        int totalCount = usersResult.Count % rowNumber > 0 ? (usersResult.Count / rowNumber) + 1 : usersResult.Count / rowNumber;

        hdnTotalCount.Value = totalCount.ToString();

        pnlPager.Visible = usersResult.Count > rowNumber;

        rptUsers.DataSource = usersResult.Dt;
        rptUsers.DataBind();
    }
Exemplo n.º 9
0
    private void BindNews()
    {
        RptNews.DataSource = null;
        RptNews.DataBind();

        PnlFilter.ControlsBind(FilterDictionary, TableName);

        int NewsID;

        int.TryParse(TxtNewsID.Text, out NewsID);
        if (NewsID == 0)
        {
            NewsID = -1;
        }

        FilterDictionary = new Dictionary <string, object>()
        {
            { "Id", NewsID },
            { "LangsId", Langs.Id },
            { "OrganizationsId", DALCL._Login.organizationsId },
            { "OrganizationsLangsId", Langs.Id },
            { "NewsLangsStatusId", int.Parse(DListNewsStatus.SelectedValue) }
        };

        int PageNum;
        int RowNumber = 50;

        if (!int.TryParse(ConfigL._Route("pagenum", "1"), out PageNum))
        {
            PageNum = 1;
        }

        HdnPageNumber.Value = PageNum.ToString();

        DALC.DataTableResult NewsResult = DALC.GetFilterList(Tools.Tables.V_News, FilterDictionary, PageNum, RowNumber);

        if (NewsResult.Count == -1)
        {
            return;
        }

        LblCount.Text = string.Format("Axtarış üzrə nəticə: {0}", NewsResult.Count.ToString());

        int Total_Count = NewsResult.Count % RowNumber > 0 ? (NewsResult.Count / RowNumber) + 1 : NewsResult.Count / RowNumber;

        HdnTotalCount.Value = Total_Count.ToString();

        PnlPager.Visible = NewsResult.Count > RowNumber;

        RptNews.DataSource = NewsResult.Dt;
        RptNews.DataBind();
    }
Exemplo n.º 10
0
    private void BindGrdServices()
    {
        GrdServices.DataSource = null;
        GrdServices.DataBind();

        PnlSearch.BindControls(FilterDictionary, TableName);

        var Dictionary = new Dictionary <string, object>()
        {
            { "OrganizationsID", int.Parse(DListFilterOrganizations.SelectedValue) },
        };

        int PageNum;
        int RowNumber = 20;

        if (!int.TryParse(Config._GetQueryString("p"), out PageNum))
        {
            PageNum = 1;
        }

        HdnPageNumber.Value = PageNum.ToString();

        DALC.DataTableResult FilterList = DALC.GetFilterList(TableName, Dictionary, PageNum, RowNumber, "Order By ID asc, Name asc");

        if (FilterList.Count == -1)
        {
            return;
        }

        if (FilterList.Dt.Rows.Count < 1 && PageNum > 1)
        {
            Config.RedirectURL(string.Format("/tools/electronicregistry/servicesplans?p={0}", PageNum - 1));
        }

        LblCount.Text = string.Format("Axtarış üzrə nəticə: {0}", FilterList.Count);
        int Total_Count = 0;

        if (FilterList.Count % RowNumber > 0)
        {
            Total_Count = (FilterList.Count / RowNumber) + 1;
        }
        else
        {
            Total_Count = FilterList.Count / RowNumber;
        }

        HdnTotalCount.Value    = Total_Count.ToString();
        PnlPager.Visible       = FilterList.Count > RowNumber;
        GrdServices.DataSource = FilterList.Dt;
        GrdServices.DataBind();
    }
Exemplo n.º 11
0
    private void BindAdministrators()
    {
        grdAdministrators.DataSource = null;
        grdAdministrators.DataBind();

        pnlFilter.ControlsBind(filterDictionary, tableName);

        int administratorsId;

        int.TryParse(txtAdministratorsId.Text, out administratorsId);
        if (administratorsId == 0)
        {
            administratorsId = -1;
        }

        filterDictionary = new Dictionary <string, object>()
        {
            { "Id", administratorsId },
            { "OrganizationsId", int.Parse(dListOrganizations.SelectedValue) },
            { "OrganizationsLangsId", (int)Tools.Langs.AZ },
            { "AdministratorsStatusId", int.Parse(dListAdministratorsStatus.SelectedValue) }
        };

        int pageNumber;
        int rowNumber = 50;

        if (!int.TryParse(ConfigL._Route("pagenum", "1"), out pageNumber))
        {
            pageNumber = 1;
        }

        HdnPageNumber.Value = pageNumber.ToString();

        DALC.DataTableResult administratorsResult = DALC.GetFilterList(tableName, filterDictionary, pageNumber, rowNumber);

        if (administratorsResult.Count == -1)
        {
            return;
        }

        lblCount.Text = string.Format("Axtarış üzrə nəticə: {0}", administratorsResult.Count.ToString());

        int totalCount = administratorsResult.Count % rowNumber > 0 ? (administratorsResult.Count / rowNumber) + 1 : administratorsResult.Count / rowNumber;

        hdnTotalCount.Value = totalCount.ToString();

        pnlPager.Visible = administratorsResult.Count > rowNumber;

        grdAdministrators.DataSource = administratorsResult.Dt;
        grdAdministrators.DataBind();
    }
Exemplo n.º 12
0
    private void BindSurveys()
    {
        grdSurveys.DataSource = null;
        grdSurveys.DataBind();

        pnlFilter.ControlsBind(filterDictionary, tableName);

        int surveysId;

        int.TryParse(txtSurveysId.Text, out surveysId);
        if (surveysId == 0)
        {
            surveysId = -1;
        }

        filterDictionary = new Dictionary <string, object>()
        {
            { "Id", surveysId },
            { "LangsId", Langs.Id },
            { "SurveysStatusId", int.Parse(dListSurveysStatus.SelectedValue) }
        };

        int pageNumber;
        int rowNumber = 50;

        if (!int.TryParse(ConfigL._Route("pagenum", "1"), out pageNumber))
        {
            pageNumber = 1;
        }

        HdnPageNumber.Value = pageNumber.ToString();

        DALC.DataTableResult surveysResult = DALC.GetFilterList(tableName, filterDictionary, pageNumber, rowNumber);

        if (surveysResult.Count == -1)
        {
            return;
        }

        lblCount.Text = string.Format("Axtarış üzrə nəticə: {0}", surveysResult.Count.ToString());

        int totalCount = surveysResult.Count % rowNumber > 0 ? (surveysResult.Count / rowNumber) + 1 : surveysResult.Count / rowNumber;

        hdnTotalCount.Value = totalCount.ToString();

        pnlPager.Visible = surveysResult.Count > rowNumber;

        grdSurveys.DataSource = surveysResult.Dt;
        grdSurveys.DataBind();
    }
Exemplo n.º 13
0
    private void BindGrdApplicationsPersons()
    {
        GrdApplicationsDetails.DataSource = null;
        GrdApplicationsDetails.DataBind();

        var Dictionary = new Dictionary <string, object>()
        {
            { "ApplicationsID", _ApplicationsID }
        };

        DALC.DataTableResult PersonsList = DALC.GetFilterList(Tools.Table.V_ApplicationsPersons, Dictionary, 1, 20);

        GrdApplicationsDetails.DataSource = PersonsList.Dt;
        GrdApplicationsDetails.DataBind();
    }
Exemplo n.º 14
0
    private void BindData()
    {
        GrdUserLogs.DataSource = null;
        GrdUserLogs.DataBind();

        FilterDictionary = new Dictionary <string, object>()
        {
            { "PIN", TxtPin.Text },
            { "AdoptionOrganizationsID", DListOrganizations.SelectedValue },
            { "RegisterNo", TxtRegisterNo.Text },
            { "SearchParams(LIKE)", TxtContent.Text }
        };

        int PageNum;
        int RowNumber = 20;

        if (!int.TryParse(Config._GetQueryString("pn"), out PageNum))
        {
            PageNum = 1;
        }

        HdnPageNumber.Value = PageNum.ToString();

        DALC.DataTableResult AdoptionSearchResult = DALC_Adoption.GetAdoptionSearchHistory(FilterDictionary, PageNum, RowNumber);

        if (AdoptionSearchResult.Count == -1)
        {
            return;
        }

        if (AdoptionSearchResult.Dt.Rows.Count < 1 && PageNum > 1)
        {
            Config.Redirect(string.Format("/adoptionadminn/tools/?p=servicesuserslogs&pn={0}", PageNum - 1));
        }

        LblCount.Text = string.Format("Tapılıb: {0}", AdoptionSearchResult.Count.ToString());

        int Total_Count = AdoptionSearchResult.Count % RowNumber > 0 ? (AdoptionSearchResult.Count / RowNumber) + 1 : AdoptionSearchResult.Count / RowNumber;

        HdnTotalCount.Value = Total_Count.ToString();

        PnlPager.Visible = AdoptionSearchResult.Count > RowNumber;

        GrdUserLogs.DataSource = AdoptionSearchResult.Dt;
        GrdUserLogs.DataBind();
    }
Exemplo n.º 15
0
    private void BindSurveysAnswers()
    {
        pnlAnswers.Visible = true;
        DALC.DataTableResult result = new DALC.DataTableResult();
        var dictionary = new Dictionary <string, object>()
        {
            { "SurveysId", _surveysId },
            { "LangsId", Langs.Id },
            { "IsActive", true }
        };

        result = DALC.GetFilterList(Tools.Tables.V_SurveysAnswers, dictionary, 1, 500, "T.*", "", "Order By Id asc");

        if (result.Count == -1)
        {
            return;
        }

        grdSurveysAnswers.DataSource = result.Dt;
        grdSurveysAnswers.DataBind();
    }
Exemplo n.º 16
0
    private void BindServices()
    {
        DALC.DataTableResult result = new DALC.DataTableResult();
        var dictionary = new Dictionary <string, object>()
        {
            { "Id", txtServicesId.Text },
            { "ServicesTypesId", int.Parse(ConfigL._Route("servicestypesid", "10")) },
            { "LangsId", Langs.Id },
            { "IsActive", int.Parse(dListServicesStatus.SelectedValue) },
        };

        result = DALC.GetFilterList(Tools.Tables.V_Services, dictionary, 1, 500);

        if (result.Count == -1)
        {
            return;
        }

        grdSrvices.DataSource = result.Dt;
        grdSrvices.DataBind();
    }
Exemplo n.º 17
0
    private void BindServicesOrganizations()
    {
        DALC.DataTableResult result = new DALC.DataTableResult();
        var dictionary = new Dictionary <string, object>()
        {
            { "OrganizationsLangsId", Langs.Id },
            { "ServicesTypesId", (int)Tools.ServicesTypes.Xidmətlər },
            { "ServicesLangsId", Langs.Id },
            { "IsActive", true },
        };

        result = DALC.GetFilterList(Tools.Tables.V_ServicesOrganizations, dictionary, 1, 500);

        if (result.Count == -1)
        {
            return;
        }

        grdSrvices.DataSource = result.Dt;
        grdSrvices.DataBind();
    }
Exemplo n.º 18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Login control
        if (DALC._GetUsersLogin == null)
        {
            Config.Redirect("/?return=" + Request.Url.ToString());
            return;
        }

        if (!IsPostBack)
        {
            LblCount1.Text = DALC.GetDbSingleValues("Count(*)", "Persons", "");
            LblCount2.Text = DALC.GetDbSingleValues("Count(*)", "Users", "Where IsActive=1");
            LblCount3.Text = DALC.GetDbSingleValues("Count(*)", "UsersHistory", "where YEAR(Add_Dt)=YEAR(GETDATE()) and MONTH(Add_Dt) = MONTH(GETDATE())");
            LblCount4.Text = DALC.GetDbSingleValues("Count(*)", "UsersHistory", "where  FORMAT(Add_Dt,'ddMMyyyy')=FORMAT(GETDATE(),'ddMMyyyy')");

            DALC.DataTableResult HistoryTypes = DALC.GetHistory("10", DALC._GetUsersLogin.OrganizationsID._ToString(), "0", "0", "0");
            GrdHistory.DataSource = HistoryTypes.Dt;
            GrdHistory.DataBind();
        }
    }
Exemplo n.º 19
0
    protected void LnkOtherApp_Click(object sender, EventArgs e)
    {
        GrdList.DataSource = null;
        GrdList.DataBind();

        LnkOtherApp.Visible         = false;
        LblCount.Text               = "Axtarış üzrə: 0      Səhifə üzrə: 0";
        LnkOtherApp.CommandArgument = (int.Parse(LnkOtherApp.CommandArgument) + 20)._ToString();

        string PassNumber = "0";

        if (TxtFilterPassportNumber.Text.Trim().IsNumeric())
        {
            PassNumber = TxtFilterPassportNumber.Text.Trim();
        }

        DALC.DataTableResult UsersList = DALC.GetUsersList(
            LnkOtherApp.CommandArgument,
            DListFilterOrganizations.SelectedValue,
            TxtFilterUsername.Text,
            PassNumber,
            TxtFilterFullname.Text.Trim(),
            DListFilterStatus.SelectedValue);

        if (UsersList.Count == -1)
        {
            Config.MsgBoxAjax(Config._DefaultSystemErrorMessages, Page);
            return;
        }

        GrdList.DataSource = UsersList.Dt;
        GrdList.DataBind();

        LblCount.Text = "Axtarış üzrə: " + UsersList.Count + "      Səhifə üzrə: " + GrdList.Rows.Count._ToString();

        if (UsersList.Dt.Rows.Count > 0)
        {
            LnkOtherApp.Visible = (GrdList.Rows.Count < UsersList.Count);
        }
    }
Exemplo n.º 20
0
    private void BindServices()
    {
        DALC.DataTableResult result = new DALC.DataTableResult();
        var dictionary = new Dictionary <string, object>()
        {
            { "ServicesId", txtServicesId.Text },
            { "ServicesLangsId", Langs.Id },
            { "OrganizationsId", DALCL._Login.organizationsId },
            { "OrganizationsLangsId", (int)Tools.Langs.AZ },
            { "ServicesTypesId", (int)Tools.ServicesTypes.Tədbirlər },
            { "IsActive", int.Parse(dListServicesStatus.SelectedValue) },
        };

        result = DALC.GetFilterList(Tools.Tables.V_ServicesOrganizations, dictionary, 1, 500);

        if (result.Count == -1)
        {
            return;
        }

        grdSrvices.DataSource = result.Dt;
        grdSrvices.DataBind();
    }
Exemplo n.º 21
0
    private void BindGrdServicesCourses()
    {
        GrdServicesCourses.DataSource = null;
        GrdServicesCourses.DataBind();

        PnlSearch.BindControls(FilterDictionary, TableName);
        #region BetweenDateFromat

        string Start_Dt = "";
        string End_Dt   = "";

        object DateFilterStart_Dt = Config.DateTimeFormat(TxtFilterStart_Dt.Text.Trim());
        object DateFilterEnd_Dt   = Config.DateTimeFormat(TxtFilterEnd_Dt.Text.Trim());


        if (DateFilterStart_Dt != null)
        {
            Start_Dt = ((DateTime)DateFilterStart_Dt).ToString("yyyyMMdd");
        }

        if (DateFilterEnd_Dt != null)
        {
            End_Dt = ((DateTime)DateFilterEnd_Dt).ToString("yyyyMMdd");
        }

        #endregion

        var Dictionary = new Dictionary <string, object>()
        {
            { "OrganizationsID", int.Parse(DListFilterOrganizations.SelectedValue) },
            { "Start_Dt(>=)", Start_Dt },
            { "End_Dt(<=)", End_Dt }
        };

        int PageNum;
        int RowNumber = 20;
        if (!int.TryParse(Config._GetQueryString("p"), out PageNum))
        {
            PageNum = 1;
        }

        HdnPageNumber.Value = PageNum.ToString();

        DALC.DataTableResult FilterList = DALC.GetFilterList(TableName, Dictionary, PageNum, RowNumber);

        if (FilterList.Count == -1)
        {
            return;
        }

        if (FilterList.Dt.Rows.Count < 1 && PageNum > 1)
        {
            Config.RedirectURL(string.Format("/tools/electronicregistry/?p={0}", PageNum - 1));
        }

        LblCount.Text = string.Format("Axtarış üzrə nəticə: {0}", FilterList.Count);
        int Total_Count = 0;
        if (FilterList.Count % RowNumber > 0)
        {
            Total_Count = (FilterList.Count / RowNumber) + 1;
        }
        else
        {
            Total_Count = FilterList.Count / RowNumber;
        }

        HdnTotalCount.Value           = Total_Count.ToString();
        PnlPager.Visible              = FilterList.Count > RowNumber;
        GrdServicesCourses.DataSource = FilterList.Dt;
        GrdServicesCourses.DataBind();
    }
Exemplo n.º 22
0
    private void BindGallery()
    {
        RptFotoGallery.DataSource = null;
        RptFotoGallery.DataBind();

        PnlSearch.BindControls(FilterDictionary, TableName);

        FilterDictionary = new Dictionary <string, object>()
        {
            { "OrganizationsID", int.Parse(DListFilterOrganizations.SelectedValue) },
            { "DataID(!=)", 0 },
            { "DownloadsQualityTypesID", int.Parse(DListFilterDownloadsQualityTypes.SelectedValue) },
            { "DisplayName(LIKE)", TxtFilterFileName.Text },
            { "IsActive", int.Parse(DListFilterStatus.SelectedValue) },
        };

        if (PnlFilterDate.Visible == true)
        {
            FilterDictionary.Add("DownloadsTypesID", int.Parse(DListFilterDownloadsTypes.SelectedValue));
            FilterDictionary.Add("Years", int.Parse(DListFilterYears.SelectedValue));
            FilterDictionary.Add("Months", int.Parse(DListFilterMonths.SelectedValue));
        }


        int PageNum;
        int RowNumber = 20;

        if (!int.TryParse(Config._GetQueryString("p"), out PageNum))
        {
            PageNum = 1;
        }


        HdnPageNumber.Value = PageNum.ToString();

        DALC.DataTableResult FilterList = DALC.GetFilterList(TableName, FilterDictionary, PageNum, RowNumber);

        if (FilterList.Count == -1)
        {
            return;
        }

        if (FilterList.Dt.Rows.Count < 1 && PageNum > 1)
        {
            Config.RedirectURL(string.Format("/tools/downloads/?p={0}", PageNum - 1));
        }

        int Total_Count = 0;

        if (FilterList.Count % RowNumber > 0)
        {
            Total_Count = (FilterList.Count / RowNumber) + 1;
        }
        else
        {
            Total_Count = FilterList.Count / RowNumber;
        }

        HdnTotalCount.Value = Total_Count.ToString();
        PnlPager.Visible    = FilterList.Count > RowNumber;

        RptFotoGallery.DataSource = FilterList.Dt;
        RptFotoGallery.DataBind();
    }
    void BindGrid()
    {
        if (Session[_FilterSessionName] != null)
        {
            var DictionarySession = (Dictionary <string, object>)Session[_FilterSessionName];
            if (DictionarySession.Count != 0)
            {
                TxtRowIndexFilter.Text = DictionarySession["RowIndex"]._ToString();
                DlistRegionalCenterFilter.SelectedValue     = DictionarySession["RegionalCentersID"]._ToString();
                DListParentOrganizationFilter.SelectedValue = DictionarySession["ParentOrganizationsID"]._ToString();
                DListTopOrganizationFilter_SelectedIndexChanged(null, null);
                DListSubOrganizationFilter.SelectedValue = DictionarySession["OrganizationsID"]._ToString();
                DlistVisitTypeFilter.SelectedValue       = DictionarySession["VisitTypeID"]._ToString();
                TxtVisitDtStartFilter.Text      = DictionarySession["StartVisit_Dt"]._ToString();
                TxtVisitDtEndFilter.Text        = DictionarySession["EndVisit_Dt"]._ToString();
                TxtDescriptionFilter.Text       = DictionarySession["Descriptions"]._ToString();
                DListDatePriority.SelectedValue = DictionarySession["DatePriority"]._ToString();
                DListPageSize.SelectedValue     = DictionarySession["PageSize"]._ToString();
            }
        }

        #region BetweenDateFromat

        string Date = "";

        string Dt1 = "19000101";
        string Dt2 = DateTime.Now.ToString("yyyyMMdd");

        object DateFilter1 = Config.DateTimeFormat(TxtVisitDtStartFilter.Text.Trim());
        object DateFilter2 = Config.DateTimeFormat(TxtVisitDtEndFilter.Text.Trim());

        if (DateFilter1 == null && DateFilter2 == null)
        {
            Date = "";
        }
        else
        {
            if (DateFilter1 != null)
            {
                Dt1 = ((DateTime)DateFilter1).ToString("yyyyMMdd");
            }

            if (DateFilter2 != null)
            {
                Dt2 = ((DateTime)DateFilter2).ToString("yyyyMMdd");
            }

            Date = Dt1 + "&" + Dt2;
        }
        #endregion


        var Dictionary = new Dictionary <string, object>()
        {
            { "RegionalCentersID", DlistRegionalCenterFilter.SelectedValue },
            { "ParentOrganizationsID", DListParentOrganizationFilter.SelectedValue },
            { "OrganizationsID", DListSubOrganizationFilter.SelectedValue },
            { "VisitTypeID", DlistVisitTypeFilter.SelectedValue },
            { "Visit_Dt(BETWEEN)", Date },
            { "Descriptions(LIKE)", TxtDescriptionFilter.Text }
        };

        string OrderByType = "desc";

        if (DListDatePriority.SelectedValue == "20")
        {
            OrderByType = "asc";
        }

        //Sira sayina gore filteri elave olaraq gonderirik
        int RowIndex = -1;
        if (!int.TryParse(TxtRowIndexFilter.Text, out RowIndex))
        {
            RowIndex = -1;
        }

        int PageNum;
        int RowNumber = 30;

        if (DListPageSize.SelectedValue == "20")
        {
            RowNumber = 10000;
        }

        if (!int.TryParse(Config._GetQueryString("p"), out PageNum))
        {
            PageNum = 1;
        }

        // Axirinci sehifeni secmedikce Cache temizlemirik herdefe count almasin deye
        if (PageNum >= (Cache[_CountCacheName]._ToInt32() / RowNumber))
        {
            Cache.Remove(_CountCacheName);
        }

        HdnPageNumber.Value = PageNum.ToString();

        DALC.DataTableResult ApplicationsList = DALC.GetAuditsOrganizations(Dictionary, PageNum, RowNumber, new object[] { RowIndex }, OrderByType);

        if (ApplicationsList.Count == -1)
        {
            return;
        }

        if (ApplicationsList.Dt.Rows.Count < 1 && PageNum > 1)
        {
            Config.RedirectURL(string.Format("/tools/AuditsOrganizations/?p={0}", PageNum - 1));
        }

        int Total_Count = ApplicationsList.Count % RowNumber > 0 ? (ApplicationsList.Count / RowNumber) + 1 : ApplicationsList.Count / RowNumber;
        HdnTotalCount.Value = Total_Count.ToString();

        PnlPager.Visible = ApplicationsList.Count > RowNumber;

        GrdAuditsOrganizations.DataSource = ApplicationsList.Dt;
        GrdAuditsOrganizations.DataBind();

        LblCountInfo.Text = string.Format("Axtarış üzrə nəticə: {0}", ApplicationsList.Count);
    }
Exemplo n.º 24
0
    private void BindGridUsers()
    {
        GrdUsers.DataSource = null;
        GrdUsers.DataBind();

        if (Session[_FilterSessionName] != null)
        {
            var DictionarySession = (Dictionary <string, object>)Session[_FilterSessionName];
            if (DictionarySession.Count != 0)
            {
                DListFilterOrganizations.SelectedValue = DictionarySession["OrganizationsID"]._ToString();
                TxtFilterFullname.Text           = DictionarySession["Fullname"]._ToString();
                TxtFilterDocNumber.Text          = DictionarySession["DocumentNumber"]._ToString();
                TxtFilterPin.Text                = DictionarySession["PIN"]._ToString();
                DListFilterDocType.SelectedValue = DictionarySession["DocumentsTypesID"]._ToString();
            }
        }

        TxtFilterFullname.Text = TxtFilterFullname.Text.ToUpper();
        TxtFilterPin.Text      = TxtFilterPin.Text.ToUpper();

        var Dictionary = new Dictionary <string, object>()
        {
            { "OrganizationsID", int.Parse(DListFilterOrganizations.SelectedValue) },
            { "Fullname(LIKE)", TxtFilterFullname.Text },
            { "DocumentNumber", TxtFilterDocNumber.Text },
            { "PIN", TxtFilterPin.Text },
            { "DocumentsTypesID", int.Parse(DListFilterDocType.SelectedValue) }
        };

        int PageNum;
        int RowNumber = 20;

        if (!int.TryParse(Config._GetQueryString("p"), out PageNum))
        {
            PageNum = 1;
        }

        HdnPageNumber.Value = PageNum.ToString();

        DALC.DataTableResult UsersList = DALC.GetUsers(Dictionary, PageNum, RowNumber);

        if (UsersList.Count == -1)
        {
            return;
        }

        if (UsersList.Dt.Rows.Count < 1 && PageNum > 1)
        {
            Config.RedirectURL(string.Format("/tools/users/?p={0}", PageNum - 1));
        }

        LblCount.Text = string.Format("Axtarış üzrə nəticə: {0}", UsersList.Count);
        int Total_Count = UsersList.Count % RowNumber > 0 ? (UsersList.Count / RowNumber) + 1 : UsersList.Count / RowNumber;

        HdnTotalCount.Value = Total_Count.ToString();

        PnlPager.Visible = UsersList.Count > RowNumber;

        GrdUsers.DataSource = UsersList.Dt;
        GrdUsers.DataBind();
    }
Exemplo n.º 25
0
    public static DALC.DataTableResult GetAdoptionPersons(Dictionary <string, object> Dictionary, int PageNumber, int RowNumber = 20)
    {
        DALC.DataTableResult AdoptionPersonsList = new DALC.DataTableResult();
        SqlCommand           com = new SqlCommand();
        string Key   = "";
        object Value = "";

        string[] Query = { "IS NULL", "IS NOT NULL" };

        StringBuilder AddWhere = new StringBuilder("Where 1=1");
        StringBuilder ORWhere  = new StringBuilder();

        if (Dictionary != null)
        {
            int i = 0;
            foreach (var Item in Dictionary)
            {
                Key   = Item.Key.ToUpper().Replace("İ", "I");
                Value = Item.Value;

                i++;
                if (!string.IsNullOrEmpty(Convert.ToString(Value)) && Convert.ToString(Value) != "-1")
                {
                    // --Eger tarix araligi lazim olarsa--
                    if (Key.Contains("(BETWEEN)"))
                    {
                        AddWhere.AppendFormat(" and ({0} Between @PDt1{1} and @PDt2{1})", Key.Replace("(BETWEEN)", ""), i.ToString());

                        com.Parameters.Add("@PDt1" + i.ToString(), SqlDbType.NVarChar).Value = Value._ToString().Split('&')[0];
                        com.Parameters.Add("@PDt2" + i.ToString(), SqlDbType.NVarChar).Value = Value._ToString().Split('&')[1];
                    }
                    else if (Key.Contains("(LIKE)"))
                    {
                        AddWhere.AppendFormat(" and {0} Like '%' + @P{1} + '%'", Key.Replace("(LIKE)", ""), i.ToString());
                        com.Parameters.AddWithValue("@P" + i.ToString(), Value.LikeFormat());
                    }
                    else if (Key.ToUpper().Contains("(IN)"))
                    {
                        AddWhere.AppendFormat(" and {0} in(Select item from SplitString(@wIn{1},','))", Key.Replace("(IN)", ""), i.ToString());
                        com.Parameters.AddWithValue("@wIn" + i.ToString(), Value);
                    }
                    else if (Key.ToUpper().Contains("(NOTIN)"))
                    {
                        AddWhere.AppendFormat(" and {0} not in(Select item from SplitString(@wNotIn{1},','))", Key.Replace("(NOTIN)", ""), i.ToString());
                        com.Parameters.AddWithValue("@wNotIn" + i.ToString(), Value);
                    }
                    else if (Array.IndexOf(Query, Value._ToString().ToUpper()) > -1)
                    {
                        AddWhere.AppendFormat(" and {0} {1}", Key, Value);
                    }
                    else
                    {
                        AddWhere.AppendFormat(" and {0}=@P{1}", Key, i.ToString());
                        com.Parameters.AddWithValue("@P" + i.ToString(), Value);
                    }
                }
            }

            if (ORWhere.Length > 0)
            {
                AddWhere.AppendFormat(" and ({0})", ORWhere.Remove(ORWhere.ToString().Length - 2, 2));
            }
        }

        string QueryCommand = @"Select {0} From (Select Row_Number() Over (Order By Ap.ID desc) as RowIndex,  
                                     CONCAT(Soyad,' ',Ad,' ',Ata) as Fullname ,  
                                     CONCAT(r.Name,' , ',c.Name) as Location ,
                                     ec.Name as EyeColor,
                                     hc.Name as HairColor,     
                                     AO.Name as AdoptionOrganizations,                                
                                     CONVERT(int,ROUND(DATEDIFF(hour,DogumTarixi,GETDATE())/8766.0,0)) as Yash,                                                                                
                                     Ap.*  From AdoptionPersons as Ap LEFT JOIN 
                                    Colors as ec on ec.ID=Ap.GozColorsID 
                                    LEFT JOIN 
                                    Colors as hc on hc.ID=Ap.SachColorsID
                                    LEFT JOIN 
                                    Countries as c on c.ID=Ap.CountriesID
                                    LEFT JOIN 
                                    Regions as r on r.ID=Ap.RegionsID
                                    LEFT JOIN 
                                    AdoptionOrganizations as AO on AO.ID=AP.AdoptionOrganizationsID {1} ) as Ap {2}";

        com.Connection = DALC.SqlConn;

        com.CommandText = string.Format(QueryCommand, "COUNT(Ap.ID)", AddWhere, "");
        try
        {
            com.Connection.Open();
            AdoptionPersonsList.Count = com.ExecuteScalar()._ToInt32();
        }
        catch (Exception er)
        {
            DALC.ErrorLogsInsert(string.Format("DALC_Adoption.GetAdoptionPersons TableName: {0} count xəta: {1}", "AdoptionPersons", er.Message));
            AdoptionPersonsList.Count = -1;
            AdoptionPersonsList.Dt    = null;
            return(AdoptionPersonsList);
        }
        finally
        {
            com.Connection.Close();
        }


        string RowIndexWhere = " Where Ap.RowIndex BETWEEN @R1 AND @R2";

        com.Parameters.Add("@R1", SqlDbType.Int).Value = ((PageNumber * RowNumber) - RowNumber) + 1;
        com.Parameters.Add("@R2", SqlDbType.Int).Value = PageNumber * RowNumber;
        com.CommandText = string.Format(QueryCommand, "Ap.* ", AddWhere, RowIndexWhere);
        try
        {
            new SqlDataAdapter(com).Fill(AdoptionPersonsList.Dt);
            return(AdoptionPersonsList);
        }
        catch (Exception er)
        {
            DALC.ErrorLogsInsert(string.Format("DALC_Adoption.GetAdoptionPersons TableName: {0} xəta: {1}", "AdoptionPersons", er.Message));
            AdoptionPersonsList.Count = -1;
            AdoptionPersonsList.Dt    = null;
            return(AdoptionPersonsList);
        }
    }
Exemplo n.º 26
0
    private void BindGrdCourses()
    {
        GrdServicesCourses.DataSource = null;
        GrdServicesCourses.DataBind();

        PnlSearch.BindControls(FilterDictionary, TableName);

        #region BetweenDateFromat

        string Date = "";

        string Dt1 = "20170101";
        string Dt2 = DateTime.Now.ToString("yyyyMMdd");

        object DateFilter1 = Config.DateTimeFormat(TxtFilterStart_Dt.Text.Trim());
        object DateFilter2 = Config.DateTimeFormat(TxtFilterEnd_Dt.Text.Trim());

        if (DateFilter1 == null && DateFilter2 == null)
        {
            Date = "";
        }
        else
        {
            if (DateFilter1 != null)
            {
                Dt1 = ((DateTime)DateFilter1).ToString("yyyyMMdd");
            }

            if (DateFilter2 != null)
            {
                Dt2 = ((DateTime)DateFilter2).ToString("yyyyMMdd");
            }

            Date = Dt1 + "&" + Dt2;
        }
        #endregion

        var Dictionary = new Dictionary <string, object>()
        {
            { "OrganizationsID", int.Parse(DListFilterOrganizations.SelectedValue) },
            { "ServicesID", int.Parse(DListFilterServices.SelectedValue) },
            { "TeacherUsersID", int.Parse(DListFilterTeacherUsers.SelectedValue) },
            { "Name(LIKE)", TxtCourseName.Text },
            { "Start_Dt(BETWEEN)", Config.DateTimeFilter(TxtFilterStart_Dt.Text, TxtFilterEnd_Dt.Text) },
            { "IsActive", int.Parse(DListFilterStatus.SelectedValue) },
        };

        int PageNum;
        int RowNumber = 20;
        if (!int.TryParse(Config._GetQueryString("p"), out PageNum))
        {
            PageNum = 1;
        }

        HdnPageNumber.Value = PageNum.ToString();

        DALC.DataTableResult FilterList = DALC.GetFilterList(TableName, Dictionary, PageNum, RowNumber);

        if (FilterList.Count == -1)
        {
            return;
        }

        if (FilterList.Dt.Rows.Count < 1 && PageNum > 1)
        {
            Config.RedirectURL(string.Format("/tools/electronicregistry/courses/?p={0}", PageNum - 1));
        }

        LblCount.Text = string.Format("Axtarış üzrə nəticə: {0}", FilterList.Count);
        int Total_Count = 0;
        if (FilterList.Count % RowNumber > 0)
        {
            Total_Count = (FilterList.Count / RowNumber) + 1;
        }
        else
        {
            Total_Count = FilterList.Count / RowNumber;
        }

        HdnTotalCount.Value           = Total_Count.ToString();
        PnlPager.Visible              = FilterList.Count > RowNumber;
        GrdServicesCourses.DataSource = FilterList.Dt;
        GrdServicesCourses.DataBind();
    }
Exemplo n.º 27
0
    public static DALC.DataTableResult GetAdoptionAdministratorHistory(int Top, Dictionary <string, object> Dictionary, string OrderBy = "")
    {
        DALC.DataTableResult AdoptionAdministratorHistory = new DALC.DataTableResult();
        SqlCommand           com = new SqlCommand();
        string Key   = "";
        object Value = "";

        string[]      Query    = { "IS NULL", "IS NOT NULL" };
        StringBuilder AddWhere = new StringBuilder("Where 1=1");
        StringBuilder ORWhere  = new StringBuilder();

        if (Dictionary != null)
        {
            int i = 0;
            foreach (var Item in Dictionary)
            {
                Key   = Item.Key.ToUpper().Replace("İ", "I");
                Value = Item.Value;
                i++;
                if (!string.IsNullOrEmpty(Convert.ToString(Value)) && Convert.ToString(Value) != "-1")
                {
                    // --Eger tarix araligi lazim olarsa--
                    if (Key.Contains("(BETWEEN)"))
                    {
                        AddWhere.AppendFormat(" and ({0} Between @PDt1{1} and @PDt2{1})", Key.Replace("(BETWEEN)", ""), i.ToString());

                        com.Parameters.Add("@PDt1" + i.ToString(), SqlDbType.NVarChar).Value = Value._ToString().Split('&')[0];
                        com.Parameters.Add("@PDt2" + i.ToString(), SqlDbType.NVarChar).Value = Value._ToString().Split('&')[1] + " 23:59:59";
                    }
                    else if (Key.Contains("(LIKE)"))
                    {
                        AddWhere.AppendFormat(" and {0} Like '%' + @P{1} + '%'", Key.Replace("(LIKE)", ""), i.ToString());
                        com.Parameters.AddWithValue("@P" + i.ToString(), Value);
                    }
                    else if (Key.ToUpper().Contains("(IN)"))
                    {
                        AddWhere.AppendFormat(" and {0} in(Select item from SplitString(@wIn{0},','))", Key.Replace("(IN)", ""));
                        com.Parameters.AddWithValue("@wIn" + Key.Replace("(IN)", ""), Value);
                    }

                    else if (Array.IndexOf(Query, Value._ToString().ToUpper()) > -1)
                    {
                        AddWhere.AppendFormat(" and {0} {1}", Key, Value);
                    }
                    else
                    {
                        AddWhere.AppendFormat(" and {0}=@P{1}", Key, i.ToString());
                        com.Parameters.AddWithValue("@P" + i.ToString(), Value);
                    }
                }
            }
            if (ORWhere.Length > 0)
            {
                AddWhere.AppendFormat(" and ({0})", ORWhere.Remove(ORWhere.ToString().Length - 2, 2));
            }
        }

        string QueryCommand = @"Select {0} From 
                                AdoptionAdministratorsHistory as AAH
                                LEFT JOIN 
                                AdoptionAdministrators as AA on AAH.AdoptionAdministratorsID=AA.ID {1} {2}";

        com.Connection = DALC.SqlConn;


        com.CommandText = string.Format(QueryCommand, "COUNT(AAH.ID)", AddWhere, OrderBy);
        try
        {
            com.Connection.Open();
            AdoptionAdministratorHistory.Count = com.ExecuteScalar()._ToInt32();
        }
        catch (Exception er)
        {
            DALC.ErrorLogsInsert("AdoptionAdministratorHistory count xəta: " + er.Message);
            AdoptionAdministratorHistory.Count = -1;
            AdoptionAdministratorHistory.Dt    = null;
            return(AdoptionAdministratorHistory);
        }
        finally
        {
            com.Connection.Close();
        }


        com.CommandText = String.Format(QueryCommand, @"Top (@Top)  
                                                        AAH.ID,
                                                        AAH.AdoptionAdministratorsID,
                                                        AA.Username as UserName,
                                                        AA.Fullname as FullName,
                                                        AAH.LogText as Logtext,
                                                        FORMAT(AAH.Add_Dt, 'dd.MM.yyyy hh:mm') as Date,
                                                        AAH.Add_Ip as Ip", AddWhere, OrderBy);
        com.Parameters.Add("@Top", SqlDbType.Int).Value = Top;
        try
        {
            new SqlDataAdapter(com).Fill(AdoptionAdministratorHistory.Dt);
            return(AdoptionAdministratorHistory);
        }
        catch (Exception er)
        {
            DALC.ErrorLogsInsert("AdoptionAdministratorHistory xəta: " + er.Message);
            AdoptionAdministratorHistory.Count = -1;
            AdoptionAdministratorHistory.Dt    = null;
            return(AdoptionAdministratorHistory);
        }
    }
    void BindGrid()
    {

        if (Session[_FilterSessionName] != null)
        {
            var DictionarySession = (Dictionary<string, object>)Session[_FilterSessionName];
            if (DictionarySession.Count != 0)
            {
                TxtRowIndexFilter.Text = DictionarySession["RowIndex"]._ToString();
                TxtNumbersFilter.Text = DictionarySession["Numbers"]._ToString();
                DListComplaintTypeFilter.SelectedValue = DictionarySession["ComplaintTypeID"]._ToString();
                DlistExecutiveUsersFilter.SelectedValue = DictionarySession["ExecutiveUsersID"]._ToString();
                TxtApplicantsFullnameFilter.Text = DictionarySession["ApplicantsFullname"]._ToString();
                DListApplicantsGenderTypeFilter.SelectedValue = DictionarySession["GenderTypeID"]._ToString();
                DListApplicantsSocialStatusFilter.SelectedValue = DictionarySession["SocialStatusID"]._ToString();
                TxtVictimsFullnameFilter.Text = DictionarySession["VictimsFullname"]._ToString();
                TxtComplaintInstitutionFilter.Text = DictionarySession["ComplaintInstitution"]._ToString();
                DListComplaintResultTypeFilter.SelectedValue = DictionarySession["ComplaintResultTypeID"]._ToString();
                TxtResultsFilter.Text = DictionarySession["Results"]._ToString();
                TxtEnterOrganizationsStartDtFilter.Text = DictionarySession["StartEnterOrganizations_Dt"]._ToString();
                TxtEnterOrganizationsEndDtFilter.Text = DictionarySession["EndEnterOrganizations_Dt"]._ToString();
                TxtEnterSectorStartDtFilter.Text = DictionarySession["StartEnterSector_Dt"]._ToString();
                TxtEnterSectorEndDtFilter.Text = DictionarySession["EndEnterSector_Dt"]._ToString();
                DListDatePriority.SelectedValue = DictionarySession["DatePriority"]._ToString();
                DListPageSize.SelectedValue = DictionarySession["PageSize"]._ToString();
            }
        }

        #region BetweenDateFromat

        string OrganizationsDate = "";

        string Dt1 = "19000101";
        string Dt2 = DateTime.Now.ToString("yyyyMMdd");

        object DateFilter1 = Config.DateTimeFormat(TxtEnterOrganizationsStartDtFilter.Text.Trim());
        object DateFilter2 = Config.DateTimeFormat(TxtEnterOrganizationsEndDtFilter.Text.Trim());

        if (DateFilter1 == null && DateFilter2 == null)
        {
            OrganizationsDate = "";
        }
        else
        {
            if (DateFilter1 != null)
            {
                Dt1 = ((DateTime)DateFilter1).ToString("yyyyMMdd");
            }

            if (DateFilter2 != null)
            {
                Dt2 = ((DateTime)DateFilter2).ToString("yyyyMMdd");
            }

            OrganizationsDate = Dt1 + "&" + Dt2;
        }


        string SectorDate = "";

        Dt1 = "19000101";
        Dt2 = DateTime.Now.ToString("yyyyMMdd");

        DateFilter1 = Config.DateTimeFormat(TxtEnterSectorStartDtFilter.Text.Trim());
        DateFilter2 = Config.DateTimeFormat(TxtEnterSectorEndDtFilter.Text.Trim());

        if (DateFilter1 == null && DateFilter2 == null)
        {
            SectorDate = "";
        }
        else
        {
            if (DateFilter1 != null)
            {
                Dt1 = ((DateTime)DateFilter1).ToString("yyyyMMdd");
            }

            if (DateFilter2 != null)
            {
                Dt2 = ((DateTime)DateFilter2).ToString("yyyyMMdd");
            }

            SectorDate = Dt1 + "&" + Dt2;

        }
        #endregion

        var Dictionary = new Dictionary<string, object>()
        {
            {"Numbers",TxtNumbersFilter.Text},
            {"ComplaintTypeID",int.Parse(DListComplaintTypeFilter.SelectedValue)},
            {"ExecutiveUsersID",int.Parse(DlistExecutiveUsersFilter.SelectedValue) },
            {"GenderTypeID",int.Parse(DListApplicantsGenderTypeFilter.SelectedValue) },
            {"SocialStatusID",int.Parse(DListApplicantsSocialStatusFilter.SelectedValue) },
            {"(LIKE)ApplicantsFullname",TxtApplicantsFullnameFilter.Text},
            {"(LIKE)VictimsFullname",TxtVictimsFullnameFilter.Text},
            {"ComplaintInstitution", TxtComplaintInstitutionFilter.Text},
            {"ComplaintResultTypeID", DListComplaintResultTypeFilter.SelectedValue},
            {"(LIKE)Results", TxtResultsFilter.Text},
            {"EnterOrganizations_Dt(BETWEEN)", OrganizationsDate},
            {"EnterSector_Dt(BETWEEN)", SectorDate}
        };

        //Sira sayina gore filteri elave olaraq gonderirik
        int RowIndex = -1;
        if (!int.TryParse(TxtRowIndexFilter.Text, out RowIndex))
        {
            RowIndex = -1;
        }


        int PageNum;
        int RowNumber = 30;

        if (DListPageSize.SelectedValue == "20")
        {
            RowNumber = 10000;
        }

        string OrderByType = "desc";

        if (DListDatePriority.SelectedValue == "20")
        {
            OrderByType = "asc";
        }

        if (!int.TryParse(Config._GetQueryString("p"), out PageNum))
        {
            PageNum = 1;
        }

        // Axirinci sehifeni secmedikce Cache temizlemirik herdefe count almasin deye
        if (PageNum >= (Cache[_CountCacheName]._ToInt32() / RowNumber))
        {
            Cache.Remove(_CountCacheName);
        }

        HdnPageNumber.Value = PageNum.ToString();

        DALC.DataTableResult ApplicationsList = DALC.GetIndividualComplaints(Dictionary, PageNum, RowNumber, new object[] { RowIndex }, OrderByType);

        if (ApplicationsList.Count == -1)
        {
            return;
        }

        if (ApplicationsList.Dt.Rows.Count < 1 && PageNum > 1)
        {
            Config.RedirectURL(string.Format("/tools/IndividualComplaints/?p={0}", PageNum - 1));
        }

        int Total_Count = ApplicationsList.Count % RowNumber > 0 ? (ApplicationsList.Count / RowNumber) + 1 : ApplicationsList.Count / RowNumber;
        HdnTotalCount.Value = Total_Count.ToString();

        PnlPager.Visible = ApplicationsList.Count > RowNumber;

        GrdIndividualComplaints.DataSource = ApplicationsList.Dt;
        GrdIndividualComplaints.DataBind();

        LblCountInfo.Text = string.Format("Axtarış üzrə nəticə: {0}", ApplicationsList.Count);

    }
Exemplo n.º 29
0
    private void BindGrdApplicationsPersons()
    {
        GrdApplicationsPersons.DataSource = null;
        GrdApplicationsPersons.DataBind();

        PnlSearch.BindControls(FilterDictionary, _TableName);

        FilterDictionary = new Dictionary <string, object>()
        {
            { "OrganizationsID", int.Parse(DListFltOrganizations.SelectedValue) },
            { "ID", TxtFltPersonID.Text },
            { "ApplicationsID", TxtFltApplicationsID.Text },
            { "ApplicationsTypesID", int.Parse(DListFltApplicationsTypes.SelectedValue) },
            { "ApplicationsPersonsTypesID", int.Parse(DListFltApplicationsPersonsType.SelectedValue) },
            { "DocumentTypesID", int.Parse(DListFltDocumentTypes.SelectedValue) },
            { "DocumentNumber", TxtFltDocumentNumber.Text },
            { "Surname(LIKE)", TxtFltSurname.Text },
            { "Name(LIKE)", TxtFltName.Text },
            { "Patronymic(LIKE)", TxtFltPatronymic.Text },
            { "SocialStatusID", int.Parse(DListFltSocialStatusID.SelectedValue) },
            { "RegisteredAddress(LIKE)", TxtFilterRegisteredAddress.Text },
            { "CurrentAddress(LIKE)", TxtFilterCurrentAddress.Text },
            { "Add_Dt(Between)", Config.DateTimeFilter(TxtFilterDate1.Text, TxtFilterDate2.Text) },
        };

        if (PnlOperations.Visible == true)
        {
            //Əməliyyatlar multi secim oldugu ucun onun axtarish algoritmasini elave olaraq burda yazdim
            for (int i = 0; i < DListFltListOperationTypes.Items.Count; i++)
            {
                ListItem Item = DListFltListOperationTypes.Items[i];
                if (Item.Selected == true)
                {
                    FilterDictionary.Add(((Tools.ListOperationTypes) int.Parse(Item.Value)).ToDescriptionString() + "(OR)", "IS NOT NULL");
                }
            }
        }
        else
        {
            switch (Config._GetQueryString("type"))
            {
            case "sibr-evaluations":
                FilterDictionary.Add("SIBRID", "IS NOT NULL");
                ((Literal)Master.FindControl("LtrTitle")).Text = "SIB-R Qiymətləndirilənlər";
                break;

            case "evaluations":
                FilterDictionary.Add("EvaluationsID", "IS NOT NULL");
                ((Literal)Master.FindControl("LtrTitle")).Text = "Qiymətləndirilənlər";
                break;

            case "evaluationsskill":
                FilterDictionary.Add("EvaluationsSkillID", "IS NOT NULL");
                ((Literal)Master.FindControl("LtrTitle")).Text = "Qiymətləndirilənlər";
                break;

            case "services":
                FilterDictionary.Add("ApplicationsPersonsServicesID", "IS NOT NULL");
                ((Literal)Master.FindControl("LtrTitle")).Text = "Xidmətlərdən istifadə edənlər";
                break;

            case "case":
                FilterDictionary.Add("ApplicationsCaseID", "IS NOT NULL");
                ((Literal)Master.FindControl("LtrTitle")).Text = "CASE açılanlar";
                break;

            default:
                break;
            }
        }

        int PageNum;
        int RowNumber = 20;

        if (!int.TryParse(Config._GetQueryString("p"), out PageNum))
        {
            PageNum = 1;
        }

        HdnPageNumber.Value = PageNum.ToString();

        DALC.DataTableResult FilterList = DALC.GetFilterList(_TableName, FilterDictionary, PageNum, RowNumber);

        if (FilterList.Count == -1)
        {
            return;
        }

        if (FilterList.Dt.Rows.Count < 1 && PageNum > 1)
        {
            Config.RedirectURL(string.Format("/tools/applicationspersons/?p={0}", PageNum - 1));
        }

        LblCount.Text = string.Format("Axtarış üzrə nəticə: {0}", FilterList.Count);
        int Total_Count = 0;

        if (FilterList.Count % RowNumber > 0)
        {
            Total_Count = (FilterList.Count / RowNumber) + 1;
        }
        else
        {
            Total_Count = FilterList.Count / RowNumber;
        }

        HdnTotalCount.Value = Total_Count.ToString();
        PnlPager.Visible    = FilterList.Count > RowNumber;
        GrdApplicationsPersons.DataSource = FilterList.Dt;
        GrdApplicationsPersons.DataBind();
    }
Exemplo n.º 30
0
    public static DALC.DataTableResult GetAdoptionSearchHistory(Dictionary <string, object> Dictionary, int PageNumber, int RowNumber = 20)
    {
        DALC.DataTableResult AdoptionSearchHistory = new DALC.DataTableResult();
        SqlCommand           com = new SqlCommand();
        string Key   = "";
        object Value = "";

        string[] Query = { "IS NULL", "IS NOT NULL" };

        StringBuilder AddWhere = new StringBuilder("Where 1=1");
        StringBuilder ORWhere  = new StringBuilder();

        if (Dictionary != null)
        {
            int i = 0;
            foreach (var Item in Dictionary)
            {
                Key   = Item.Key.ToUpper().Replace("İ", "I");
                Value = Item.Value;

                i++;
                if (!string.IsNullOrEmpty(Convert.ToString(Value)) && Convert.ToString(Value) != "-1")
                {
                    // --Eger tarix araligi lazim olarsa--
                    if (Key.Contains("(BETWEEN)"))
                    {
                        AddWhere.AppendFormat(" and ({0} Between @PDt1{1} and @PDt2{1})", Key.Replace("(BETWEEN)", ""), i.ToString());

                        com.Parameters.Add("@PDt1" + i.ToString(), SqlDbType.NVarChar).Value = Value._ToString().Split('&')[0];
                        com.Parameters.Add("@PDt2" + i.ToString(), SqlDbType.NVarChar).Value = Value._ToString().Split('&')[1];
                    }
                    else if (Key.Contains("(LIKE)"))
                    {
                        AddWhere.AppendFormat(" and {0} Like '%' + @P{1} + '%'", Key.Replace("(LIKE)", ""), i.ToString());
                        com.Parameters.AddWithValue("@P" + i.ToString(), Value.LikeFormat());
                    }
                    else if (Key.ToUpper().Contains("(IN)"))
                    {
                        AddWhere.AppendFormat(" and {0} in(Select item from SplitString(@wIn{1},','))", Key.Replace("(IN)", ""), i.ToString());
                        com.Parameters.AddWithValue("@wIn" + i.ToString(), Value);
                    }
                    else if (Key.ToUpper().Contains("(NOTIN)"))
                    {
                        AddWhere.AppendFormat(" and {0} not in(Select item from SplitString(@wNotIn{1},','))", Key.Replace("(NOTIN)", ""), i.ToString());
                        com.Parameters.AddWithValue("@wNotIn" + i.ToString(), Value);
                    }
                    else if (Array.IndexOf(Query, Value._ToString().ToUpper()) > -1)
                    {
                        AddWhere.AppendFormat(" and {0} {1}", Key, Value);
                    }
                    else
                    {
                        AddWhere.AppendFormat(" and {0}=@P{1}", Key, i.ToString());
                        com.Parameters.AddWithValue("@P" + i.ToString(), Value);
                    }
                }
            }

            if (ORWhere.Length > 0)
            {
                AddWhere.AppendFormat(" and ({0})", ORWhere.Remove(ORWhere.ToString().Length - 2, 2));
            }
        }

        string QueryCommand = @"Select {0} From (Select Row_Number() Over (Order By ASH.ID desc) as RowIndex,                                                                                               
                                     ASH.*,AO.Name as AdoptionOrganizations  From AdoptionSearchHistory as ASH 
                                    LEFT JOIN 
                                    AdoptionOrganizations as AO on AO.ID=ASH.AdoptionOrganizationsID 
                                    {1} ) as ASH {2}";

        com.Connection = DALC.SqlConn;

        com.CommandText = string.Format(QueryCommand, "COUNT(ASH.ID)", AddWhere, "");
        try
        {
            com.Connection.Open();
            AdoptionSearchHistory.Count = com.ExecuteScalar()._ToInt32();
        }
        catch (Exception er)
        {
            DALC.ErrorLogsInsert(string.Format("DALC_Adoption.GetAdoptionSearchHistory TableName: {0} count xəta: {1}", "AdoptionSearchHistory", er.Message));
            AdoptionSearchHistory.Count = -1;
            AdoptionSearchHistory.Dt    = null;
            return(AdoptionSearchHistory);
        }
        finally
        {
            com.Connection.Close();
        }


        string RowIndexWhere = " Where ASH.RowIndex BETWEEN @R1 AND @R2";

        com.Parameters.Add("@R1", SqlDbType.Int).Value = ((PageNumber * RowNumber) - RowNumber) + 1;
        com.Parameters.Add("@R2", SqlDbType.Int).Value = PageNumber * RowNumber;
        com.CommandText = string.Format(QueryCommand, "ASH.* ", AddWhere, RowIndexWhere);
        try
        {
            new SqlDataAdapter(com).Fill(AdoptionSearchHistory.Dt);
            return(AdoptionSearchHistory);
        }
        catch (Exception er)
        {
            DALC.ErrorLogsInsert(string.Format("DALC_Adoption.GetAdoptionSearchHistory TableName: {0} xəta: {1}", "AdoptionSearchHistory", er.Message));
            AdoptionSearchHistory.Count = -1;
            AdoptionSearchHistory.Dt    = null;
            return(AdoptionSearchHistory);
        }
    }