示例#1
0
 private void TransactionRollBack(DALC.Transaction Transaction)
 {
     Transaction.SqlTransaction.Rollback();
     Transaction.Com.Connection.Close();
     Transaction.Com.Connection.Dispose();
     Transaction.Com.Dispose();
 }
示例#2
0
    protected void BtnProcessEnds_Click(object sender, EventArgs e)
    {
        DALC.Transaction Transaction = new DALC.Transaction();
        var Dictionary = new Dictionary <string, object>()
        {
            { "IsCompleted", true },
            { "WhereID", _EvaluationsID }
        };

        _Result = DALC.UpdateDatabase(Tools.Table.Evaluations, Dictionary, Transaction);
        if (_Result < 1)
        {
            Config.MsgBoxAjax(Config._DefaultErrorMessages);
            return;
        }

        Dictionary.Clear();

        Dictionary.Add("ApplicationsPersonsID", _ApplicationsPersonsID);
        Dictionary.Add("ServicesID", (int)Tools.Services.Daxili_qiymətləndirmə);
        Dictionary.Add("ApplicationsPersonsServicesStatusID", (int)Tools.ApplicationsPersonsServicesStatus.Həll_olunub_təmin_edilib);
        Dictionary.Add("IsFirstApplication", false);
        Dictionary.Add("IsActive", true);
        Dictionary.Add("Add_Dt", DateTime.Now);
        Dictionary.Add("Add_Ip", Request.UserHostAddress.IPToInteger());

        _Result = DALC.InsertDatabase(Tools.Table.ApplicationsPersonsServices, Dictionary, Transaction, true);
        if (_Result < 1)
        {
            Config.MsgBoxAjax(Config._DefaultErrorMessages);
            return;
        }

        Config.RedirectURL(string.Format("/tools/evaluations/?i={0}", Config._GetQueryString("i")));
    }
示例#3
0
    private void TarnsactionCommitOrRollback(DALC.Transaction Transaction, bool IsCommit = false)
    {
        if (IsCommit)
        {
            Transaction.SqlTransaction.Commit();
        }
        else
        {
            Transaction.SqlTransaction.Rollback();
        }

        Transaction.Com.Connection.Close();
        Transaction.Com.Connection.Dispose();
        Transaction.Com.Dispose();
    }
    protected void LnkAddBrotherSister_Click(object sender, EventArgs e)
    {
        long ParentID = Convert.ToInt64(BtnSave.Attributes["data-parent"]);
        Dictionary <string, object> DictUpdateAddingChild = new Dictionary <string, object>()
        {
            { "ParentID", ParentID },
            { "IsBrotherSister", true },
            { "WhereID", int.Parse(LnkAddBrotherSister.CommandArgument) }
        };

        DALC.Transaction Transaction = new DALC.Transaction();
        int CheckUpdate = DALC.UpdateDatabase(_TableName, DictUpdateAddingChild, Transaction);

        if (CheckUpdate < 1)
        {
            Config.MsgBoxAjax("Sistemdə xəta baş verdi.", Page);
            return;
        }

        Dictionary <string, object> DictUpdateCurrentChild = new Dictionary <string, object>()
        {
            { "IsBrotherSister", true },
            { "WhereID", int.Parse(ChildID) }
        };

        int CheckUpdate2 = DALC.UpdateDatabase(_TableName, DictUpdateCurrentChild, Transaction, true);

        if (CheckUpdate2 < 1)
        {
            Config.MsgBoxAjax("Sistemdə xəta baş verdi.", Page);
            return;
        }

        BindSisterBrother(ParentID);
        PnlSuccess.Visible           = true;
        LnkAddBrotherSister.Visible  = false;
        PnlSisterBrotherList.Visible = true;
    }
示例#5
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        ConfigL.ClearBorderColor(pnlControls);

        if (string.IsNullOrEmpty(txtTitle.Text))
        {
            ConfigL.BorderColor(txtTitle);
            return;
        }

        if (string.IsNullOrEmpty(txtNameLangs.Text))
        {
            ConfigL.BorderColor(txtNameLangs);
            return;
        }

        if (dListStatus.SelectedValue == "-1")
        {
            ConfigL.BorderColor(dListStatus);
            return;
        }

        DALC.Transaction transaction = new DALC.Transaction();
        int check;
        var dictionaryServices = new Dictionary <string, object>()
        {
            { "ExpireDate", DateTime.Now.AddYears(1) },
            { "IsActive", int.Parse(dListStatus.SelectedValue) }
        };

        DataTable dtServicesLangs = new DataTable();

        dtServicesLangs.Columns.Add("ServicesId", typeof(int));
        dtServicesLangs.Columns.Add("LangsId", typeof(int));
        dtServicesLangs.Columns.Add("Name", typeof(string));
        dtServicesLangs.Columns.Add("Description", typeof(string));
        dtServicesLangs.Columns.Add("CreatedDate", typeof(DateTime));

        if (_operationsType == "add")
        {
            dictionaryServices.Add("MinMinute", 0);
            dictionaryServices.Add("DailyUse", 255);
            dictionaryServices.Add("UseBetweenHour", 0);
            dictionaryServices.Add("ServicesTypesId", (int)Tools.ServicesTypes.Tədbirlər);
            dictionaryServices.Add("Title", txtTitle.Text);

            int resultId = DALC.InsertDatabase(Tools.Tables.Services, dictionaryServices, transaction);
            if (resultId < 1)
            {
                ConfigL.MsgBoxAjax(Config._AlertMessages.Error);
                return;
            }

            _serviceId = resultId;

            DataRow dr;
            foreach (Tools.Langs langs in (Tools.Langs[])Enum.GetValues(typeof(Tools.Langs)))
            {
                dr = dtServicesLangs.NewRow();
                dr["ServicesId"]  = _serviceId;
                dr["LangsId"]     = (int)langs;
                dr["Name"]        = txtNameLangs.Text;
                dr["Description"] = txtDescriptionLangs.Text;
                dr["CreatedDate"] = DateTime.Now;
                dtServicesLangs.Rows.Add(dr);
            }

            resultId = DALC.InsertBulk(Tools.Tables.ServicesLangs, dtServicesLangs, transaction, true);
            if (resultId < 1)
            {
                ConfigL.MsgBoxAjax(Config._AlertMessages.Error);
                return;
            }

            var dictionaryServicesOrganizations = new Dictionary <string, object>()
            {
                { "Barcode", Guid.NewGuid() },
                { "OrganizationsId", DALCL._Login.organizationsId },
                { "ServicesId", _serviceId },
                { "IsActive", true },
                { "CreatedDate", DateTime.Now },
            };

            resultId = DALC.InsertDatabase(Tools.Tables.ServicesOrganizations, dictionaryServicesOrganizations);
            if (resultId < 1)
            {
                ConfigL.MsgBoxAjax(Config._AlertMessages.Error);
                return;
            }
        }
        else if (_operationsType == "edit")
        {
            dictionaryServices.Add("WhereId", _serviceId);

            check = DALC.UpdateDatabase(Tools.Tables.Services, dictionaryServices, transaction);
            if (check < 1)
            {
                ConfigL.MsgBoxAjax(Config._AlertMessages.Error);
                return;
            }

            var dictionaryServicesLangs = new Dictionary <string, object>()
            {
                { "Name", txtNameLangs.Text },
                { "Description", txtDescriptionLangs.Text },
                { "WhereServicesId", _serviceId },
                { "WhereLangsId", Langs.Id },
            };

            check = DALC.UpdateDatabase(Tools.Tables.ServicesLangs, dictionaryServicesLangs, transaction, true);
            if (check < 1)
            {
                ConfigL.MsgBoxAjax(Config._AlertMessages.Error);
                return;
            }
        }

        ConfigL.MsgBoxAjax(Config._AlertMessages.Success, $"/{Langs.Name}/modules/conferences/operations/edit/{_serviceId}");
    }
示例#6
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        if (!Validations())
        {
            return;
        }

        if (_ApplicationsFamilyID == 0)
        {
            _ApplicationsFamilyID = int.Parse(BtnSave.CommandArgument);
        }
        if (_ApplicationsID == 0)
        {
            _ApplicationsID = int.Parse(BtnSave.CommandName);
        }

        DALC.Transaction Transaction = new DALC.Transaction();
        var Dictionary = new Dictionary <string, object>()
        {
            { "ApplicationsID", _ApplicationsID },
            { "ApplicationsFamilyTypesID", int.Parse(DListApplicationsFamilyTypes.SelectedValue) },
            { "Address", TxtAddress.Text },
            { "ApplicationsFamilyStatusID", int.Parse(DListApplicationsFamilyStatus.SelectedValue) },
            { "Tour_Dt", TxtDate.Text.DateTimeFormat() },
            { "Description", TxtDescriptions.Text },
        };

        //Insert edek
        if (_ApplicationsFamilyID == 0)
        {
            Dictionary.Add("Add_Dt", DateTime.Now);
            Dictionary.Add("Add_Ip", Request.UserHostAddress.IPToInteger());
            _Result = DALC.InsertDatabase(Tools.Table.ApplicationsFamily, Dictionary, Transaction);
            if (_Result < 1)
            {
                Config.MsgBoxAjax(Config._DefaultErrorMessages);
                return;
            }
            _ApplicationsFamilyID = _Result;

            DataTable DtUsers = new DataTable();
            DtUsers.Columns.Add("ApplicationsFamilyID", typeof(int));
            DtUsers.Columns.Add("UsersID", typeof(int));
            DtUsers.Columns.Add("IsDeleted", typeof(bool));

            for (int i = 0; i < DListUsers.Items.Count; i++)
            {
                if (DListUsers.Items[i].Selected)
                {
                    DtUsers.Rows.Add(_ApplicationsFamilyID, DListUsers.Items[i].Value, false);
                }
            }

            _Result = DALC.InsertBulk(Tools.Table.ApplicationsFamilyUsers, DtUsers, Transaction);
            if (_Result < 1)
            {
                Config.MsgBoxAjax(Config._DefaultErrorMessages);
                return;
            }


            DataTable DtPartners = new DataTable();
            DtPartners.Columns.Add("ApplicationsFamilyID", typeof(int));
            DtPartners.Columns.Add("ApplicationsFamilyPartnersTypesID", typeof(int));
            DtPartners.Columns.Add("PersonsFullname", typeof(string));
            DtPartners.Columns.Add("IsDeleted", typeof(bool));

            for (int i = 0; i < DListApplicationsFamilyPartnersTypes.Items.Count; i++)
            {
                if (DListApplicationsFamilyPartnersTypes.Items[i].Selected)
                {
                    DtPartners.Rows.Add(_ApplicationsFamilyID, DListApplicationsFamilyPartnersTypes.Items[i].Value, ((TextBox)PnlPersons.FindControl(string.Format("Txt{0}", DListApplicationsFamilyPartnersTypes.Items[i].Value))).Text, false);
                }
            }

            if (DtPartners.Rows.Count > 0)
            {
                _Result = DALC.InsertBulk(Tools.Table.ApplicationsFamilyPartners, DtPartners, Transaction, true);
                if (_Result < 1)
                {
                    Config.MsgBoxAjax(Config._DefaultErrorMessages);
                    return;
                }
            }
            else
            {
                TarnsactionCommitOrRollback(Transaction, true);
            }
        }
        else
        {
            Dictionary.Add("WhereID", _ApplicationsFamilyID);
            _Result = DALC.UpdateDatabase(Tools.Table.ApplicationsFamily, Dictionary, Transaction);
            if (_Result < 1)
            {
                Config.MsgBoxAjax(Config._DefaultErrorMessages);
                return;
            }
            Dictionary.Clear();


            //Butun sitifadecileri IsDeleted true edek ki sonra olanlari false, olmayanlari insert edeceyik
            Dictionary.Add("ApplicationsFamilyID", _ApplicationsFamilyID);
            Dictionary.Add("IsDeleted", true);
            Dictionary.Add("WhereApplicationsFamilyID", _ApplicationsFamilyID);
            _Result = DALC.UpdateDatabase(Tools.Table.ApplicationsFamilyUsers, Dictionary);
            if (_Result < 1)
            {
                //Eger xeta bash verirse Transactionla emeliyyatlari geri qaytaraq
                TarnsactionCommitOrRollback(Transaction);
                Config.MsgBoxAjax(Config._DefaultErrorMessages);
                return;
            }

            bool   IsUpdate = false;
            string DataID   = DALC.GetSingleValues("CONCAT(CAST(UsersID as varchar),',')", Tools.Table.ApplicationsFamilyUsers, "ApplicationsFamilyID", _ApplicationsFamilyID, "for xml path('')");
            if (DataID == "-1")
            {
                //Eger xeta bash verirse Transactionla emeliyyatlari geri qaytaraq
                TarnsactionCommitOrRollback(Transaction);
                Config.MsgBoxAjax(Config._DefaultErrorMessages);
                return;
            }

            for (int i = 0; i < DListUsers.Items.Count; i++)
            {
                if (DListUsers.Items[i].Selected)
                {
                    Dictionary.Clear();
                    IsUpdate = (("," + DataID).IndexOf("," + DListUsers.Items[i].Value + ",") > -1);
                    Dictionary.Add("ApplicationsFamilyID", _ApplicationsFamilyID);
                    Dictionary.Add("UsersID", int.Parse(DListUsers.Items[i].Value));
                    Dictionary.Add("IsDeleted", false);
                    _Result = DALC.InsertOrUpdateApplicationsFamilyUsersOrPartners(Tools.Table.ApplicationsFamilyUsers, Dictionary, IsUpdate, Transaction);
                    if (_Result < 1)
                    {
                        Config.MsgBoxAjax(Config._DefaultErrorMessages);
                        return;
                    }
                }
            }

            //Butun ApplicationsFamilyPartners IsDeleted true edek ki sonra olanlari false, olmayanlari insert edeceyik
            Dictionary.Clear();
            Dictionary.Add("ApplicationsFamilyID", _ApplicationsFamilyID);
            Dictionary.Add("IsDeleted", true);
            Dictionary.Add("WhereApplicationsFamilyID", _ApplicationsFamilyID);
            _Result = DALC.UpdateDatabase(Tools.Table.ApplicationsFamilyPartners, Dictionary);
            if (_Result < 1)
            {
                //Eger xeta bash verirse Transactionla emeliyyatlari geri qaytaraq
                TarnsactionCommitOrRollback(Transaction);
                Config.MsgBoxAjax(Config._DefaultErrorMessages);
                return;
            }

            int ApplicationsFamilyPartnersTypesID = 0;
            DataID = DALC.GetSingleValues("CONCAT(CAST(ApplicationsFamilyPartnersTypesID as varchar),',')", Tools.Table.ApplicationsFamilyPartners, "ApplicationsFamilyID", _ApplicationsFamilyID, "for xml path('')");
            if (DataID == "-1")
            {
                //Eger Count alanda xeta bash verirse Transactionla emeliyyatlari geri qaytaraq
                Transaction.SqlTransaction.Rollback();
                Transaction.Com.Connection.Close();
                Transaction.Com.Connection.Dispose();
                Transaction.Com.Dispose();
                Config.MsgBoxAjax(Config._DefaultErrorMessages);
                return;
            }
            for (int i = 0; i < DListApplicationsFamilyPartnersTypes.Items.Count; i++)
            {
                if (DListApplicationsFamilyPartnersTypes.Items[i].Selected)
                {
                    Dictionary.Clear();
                    ApplicationsFamilyPartnersTypesID = int.Parse(DListApplicationsFamilyPartnersTypes.Items[i].Value);

                    IsUpdate = (("," + DataID).IndexOf("," + ApplicationsFamilyPartnersTypesID._ToString() + ",") > -1);
                    Dictionary.Add("ApplicationsFamilyID", _ApplicationsFamilyID);
                    Dictionary.Add("ApplicationsFamilyPartnersTypesID", ApplicationsFamilyPartnersTypesID);
                    Dictionary.Add("IsDeleted", false);
                    _Result = DALC.InsertOrUpdateApplicationsFamilyUsersOrPartners(Tools.Table.ApplicationsFamilyPartners, Dictionary, IsUpdate, Transaction);
                    if (_Result < 1)
                    {
                        Config.MsgBoxAjax(Config._DefaultErrorMessages);
                        return;
                    }

                    if (PnlPersons.FindControl(string.Format("Txt{0}", ApplicationsFamilyPartnersTypesID)) != null)
                    {
                        Dictionary.Clear();
                        Dictionary.Add("PersonsFullname", ((TextBox)PnlPersons.FindControl(string.Format("Txt{0}", ApplicationsFamilyPartnersTypesID))).Text);
                        Dictionary.Add("WhereApplicationsFamilyID", _ApplicationsFamilyID);
                        Dictionary.Add("WhereApplicationsFamilyPartnersTypesID", ApplicationsFamilyPartnersTypesID);
                        _Result = DALC.UpdateDatabase(Tools.Table.ApplicationsFamilyPartners, Dictionary, Transaction);
                        if (_Result < 1)
                        {
                            Config.MsgBoxAjax(Config._DefaultErrorMessages);
                            return;
                        }
                    }
                }
            }
            TarnsactionCommitOrRollback(Transaction, true);
        }

        Config.MsgBoxAjax(Config._DefaultSuccessMessages, Request.RawUrl);
    }
示例#7
0
    protected void btnSaveAnswers_Click(object sender, EventArgs e)
    {
        ConfigL.ClearBorderColor(pnlAnswers);

        if (string.IsNullOrEmpty(txtAnswer.Text))
        {
            ConfigL.BorderColor(txtAnswer);
            return;
        }

        if (DALCL.CheckSurveysAnswers(_surveysId, txtAnswer.Text))
        {
            ConfigL.BorderColor(txtAnswer);
            ConfigL.MsgBoxAjax("Bu cavab istifadə olunur!");
            return;
        }

        var dictionaryAnswers = new Dictionary <string, object>()
        {
            { "Title", txtAnswer.Text },
        };

        int surveysAnswersId;
        int result;

        DALC.Transaction transaction = new DALC.Transaction();
        if (btnSaveAnswers.CommandArgument == "0")
        {
            dictionaryAnswers.Add("SurveysId", _surveysId);
            dictionaryAnswers.Add("VotesCount", 0);
            dictionaryAnswers.Add("IsActive", true);

            result = DALC.InsertDatabase(Tools.Tables.SurveysAnswers, dictionaryAnswers, transaction);
            if (result < 1)
            {
                ConfigL.MsgBoxAjax(Config._AlertMessages.Error);
                return;
            }
            surveysAnswersId = result;


            DataTable dtAnswersLangs = new DataTable();
            dtAnswersLangs.Columns.Add("SurveysAnswersId", typeof(int));
            dtAnswersLangs.Columns.Add("LangsId", typeof(int));
            dtAnswersLangs.Columns.Add("Answer", typeof(string));
            dtAnswersLangs.Columns.Add("CreatedDate", typeof(DateTime));

            DataRow dr;
            foreach (Tools.Langs langs in (Tools.Langs[])Enum.GetValues(typeof(Tools.Langs)))
            {
                dr = dtAnswersLangs.NewRow();
                dr["SurveysAnswersId"] = surveysAnswersId;
                dr["LangsId"]          = (int)langs;
                dr["Answer"]           = txtAnswer.Text;
                dr["CreatedDate"]      = DateTime.Now;
                dtAnswersLangs.Rows.Add(dr);
            }

            result = DALC.InsertBulk(Tools.Tables.SurveysAnswersLangs, dtAnswersLangs, transaction, true);
            if (result < 1)
            {
                ConfigL.MsgBoxAjax(Config._AlertMessages.Error);
                return;
            }
        }
        else
        {
            surveysAnswersId = int.Parse(btnSaveAnswers.CommandArgument);

            dictionaryAnswers.Add("WhereId", surveysAnswersId);

            result = DALC.UpdateDatabase(Tools.Tables.SurveysAnswers, dictionaryAnswers, transaction);
            if (result < 1)
            {
                ConfigL.MsgBoxAjax(Config._AlertMessages.Error);
                return;
            }

            var dictionaryAnswersLangs = new Dictionary <string, object>()
            {
                { "Answer", txtAnswer.Text },
                { "CreatedDate", DateTime.Now },
                { "WhereSurveysAnswersId", surveysAnswersId },
                { "WhereLangsId", Langs.Id },
            };

            result = DALC.UpdateDatabase(Tools.Tables.SurveysAnswersLangs, dictionaryAnswersLangs, transaction, true);
            if (result < 1)
            {
                ConfigL.MsgBoxAjax(Config._AlertMessages.Error);
                return;
            }
        }

        txtAnswer.Text = "";
        btnSaveAnswers.CommandArgument = "0";
        BindSurveysAnswers();
    }
示例#8
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        ConfigL.ClearBorderColor(pnlControls);

        if (string.IsNullOrEmpty(txtTitle.Text))
        {
            ConfigL.BorderColor(txtTitle);
            return;
        }

        if (string.IsNullOrEmpty(txtQuestions.Text))
        {
            ConfigL.BorderColor(txtQuestions);
            return;
        }

        if (dListStatus.SelectedValue == "-1")
        {
            ConfigL.BorderColor(dListStatus);
            return;
        }

        if (DALCL.CheckSurveysQuestion(_surveysId, txtQuestions.Text))
        {
            ConfigL.BorderColor(txtQuestions);
            ConfigL.MsgBoxAjax("Bu sual istifadə olunur!");
            return;
        }

        DALC.Transaction transaction = new DALC.Transaction();
        int check;
        var dictionarySurveys = new Dictionary <string, object>()
        {
            { "SurveysStatusId", int.Parse(dListStatus.SelectedValue) }
        };

        DataTable dtSurveysLangs = new DataTable();

        dtSurveysLangs.Columns.Add("SurveysId", typeof(int));
        dtSurveysLangs.Columns.Add("LangsId", typeof(int));
        dtSurveysLangs.Columns.Add("Question", typeof(string));
        dtSurveysLangs.Columns.Add("CreatedDate", typeof(DateTime));
        dtSurveysLangs.Columns.Add("UpdatedDate", typeof(DateTime));

        if (_operationsType == "add")
        {
            dictionarySurveys.Add("OrganizationsId", DALCL._Login.organizationsId);
            dictionarySurveys.Add("Title", txtTitle.Text);
            dictionarySurveys.Add("VotesCount", 0);

            int resultId = DALC.InsertDatabase(Tools.Tables.Surveys, dictionarySurveys, transaction);
            if (resultId < 1)
            {
                ConfigL.MsgBoxAjax(Config._AlertMessages.Error);
                return;
            }

            _surveysId = resultId;
            Dictionary <string, object> dictionarySurveysSubscriptions = new Dictionary <string, object>();

            dictionarySurveysSubscriptions.Add("SurveysId", _surveysId);
            dictionarySurveysSubscriptions.Add("OrganizationsId", DALCL._Login.organizationsId);
            dictionarySurveysSubscriptions.Add("CreatedDate", DateTime.Now);
            dictionarySurveysSubscriptions.Add("IsActive", true);

            resultId = DALC.InsertDatabase(Tools.Tables.SurveysSubscriptions, dictionarySurveysSubscriptions);
            if (resultId < 1)
            {
                ConfigL.MsgBoxAjax(Config._AlertMessages.Error);
                return;
            }

            DataRow dr;
            foreach (Tools.Langs langs in (Tools.Langs[])Enum.GetValues(typeof(Tools.Langs)))
            {
                dr = dtSurveysLangs.NewRow();
                dr["SurveysId"]   = _surveysId;
                dr["LangsId"]     = (int)langs;
                dr["Question"]    = txtQuestions.Text;
                dr["CreatedDate"] = DateTime.Now;
                dr["UpdatedDate"] = DateTime.Now;
                dtSurveysLangs.Rows.Add(dr);
            }

            resultId = DALC.InsertBulk(Tools.Tables.SurveysLangs, dtSurveysLangs, transaction, true);
            if (resultId < 1)
            {
                ConfigL.MsgBoxAjax(Config._AlertMessages.Error);
                return;
            }
            ConfigL.MsgBoxAjax(Config._AlertMessages.Success, $"/{Langs.Name}/modules/surveys/operations/edit/{_surveysId}");
        }
        else if (_operationsType == "edit")
        {
            dictionarySurveys.Add("WhereId", _surveysId);

            check = DALC.UpdateDatabase(Tools.Tables.Surveys, dictionarySurveys, transaction);
            if (check < 1)
            {
                ConfigL.MsgBoxAjax(Config._AlertMessages.Error);
                return;
            }

            var dictionarySurveysLangs = new Dictionary <string, object>()
            {
                { "Question", txtQuestions.Text },
                { "UpdatedDate", DateTime.Now },
                { "WhereSurveysId", _surveysId },
                { "WhereLangsId", Langs.Id },
            };

            check = DALC.UpdateDatabase(Tools.Tables.SurveysLangs, dictionarySurveysLangs, transaction, true);
            if (check < 1)
            {
                ConfigL.MsgBoxAjax(Config._AlertMessages.Error);
                return;
            }
        }

        ConfigL.MsgBoxAjax(Config._AlertMessages.Success);
    }
示例#9
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        if (!IsValidation())
        {
            return;
        }

        DateTime ShowDate;

        if (!DateTime.TryParse(TxtShowDate.Text, out ShowDate))
        {
            ConfigL.MsgBoxAjax("Xəbərin tarixini düzgün daxil edin!");
            return;
        }

        DALC.Transaction transaction = new DALC.Transaction();
        int check;
        var dictionaryNews = new Dictionary <string, object>()
        {
            { "NewsTypesId", int.Parse(DListNewsTypes.SelectedValue) },
            { "Title", TxtTitle.Text.ClearChar13() },
            { "IsActive", 1 },
            { "ShowDate", ShowDate }
        };

        var dictionaryNewsLangs = new Dictionary <string, object>()
        {
            { "NewsLangsStatusId", DListStatus.SelectedValue },
            { "Title", TxtTitle.Text },
            { "SubTitle", TxtTitleSub.Text },
            { "ContentText", txtContent.Text },
            { "UpdatedDate", DateTime.Now },
        };

        if (_operations == "add")
        {
            dictionaryNews.Add("OrganizationsId", DALCL._Login.organizationsId);
            //dictionaryNews.Add("CreatedDate", DateTime.Now);

            int resultId = DALC.InsertDatabase(Tools.Tables.News, dictionaryNews, transaction);
            if (resultId < 1)
            {
                ConfigL.MsgBoxAjax(Config._AlertMessages.Error);
                return;
            }

            _newsId = resultId;

            dictionaryNewsLangs.Add("NewsId", resultId);
            dictionaryNewsLangs.Add("LangsId", Langs.Id);
            dictionaryNewsLangs.Add("VisitorCount", 0);
            dictionaryNewsLangs.Add("CreatedDate", DateTime.Now);


            resultId = DALC.InsertDatabase(Tools.Tables.NewsLangs, dictionaryNewsLangs, transaction, true);
            if (resultId < 1)
            {
                ConfigL.MsgBoxAjax(Config._AlertMessages.Error);
                return;
            }
        }
        else if (_operations == "edit")
        {
            dictionaryNews.Add("WhereId", _newsId);

            check = DALC.UpdateDatabase(Tools.Tables.News, dictionaryNews, transaction);
            if (check < 1)
            {
                ConfigL.MsgBoxAjax(Config._AlertMessages.Error);
                return;
            }

            dictionaryNewsLangs.Add("WhereId", int.Parse(BtnSave.CommandArgument));

            check = DALC.UpdateDatabase(Tools.Tables.NewsLangs, dictionaryNewsLangs, transaction, true);
            if (check < 1)
            {
                ConfigL.MsgBoxAjax(Config._AlertMessages.Error);
                return;
            }
        }

        string             fileName = "";
        string             path     = "/uploads/news";
        string             fileType = "";
        int                contentLenght;
        HttpFileCollection Files = Request.Files;

        DataTable dtFiles = new DataTable();

        dtFiles.Columns.Add("NewsFilesTypesId", typeof(int));
        dtFiles.Columns.Add("FilesFoldersId", typeof(int));
        dtFiles.Columns.Add("FilesTypesId", typeof(int));
        dtFiles.Columns.Add("Path", typeof(string));
        dtFiles.Columns.Add("Name", typeof(string));
        dtFiles.Columns.Add("ContentLength", typeof(int));

        DataRow dr;

        for (int i = 1; i < Files.Count; i++)
        {
            if (Files[i].ContentLength > 0)
            {
                fileType = System.IO.Path.GetExtension(Files[i].FileName).Trim('.').ToLower();
                if (_allowTypes.IndexOf($"-{fileType}-") > -1)
                {
                    if (!Files[i].CheckFileContentLength(50))
                    {
                        continue;
                    }

                    contentLenght = Files[i].ContentLength;
                    System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(Files[i].InputStream);

                    string[] folderList = null;

                    fileName = $"{_newsId}_{(i - 1).ToString()}_{DateTime.Now.ToString("ddMMyyyyHHmmssfff")}.{fileType}";
                    if (i == 1)
                    {
                        //Boyuk original sekil nece var ama azmaz keyfiyyeti ile oynuyaq.
                        ImageResize.ImgResize($"{path}/main/{fileName}", bmp.Width, bmp.Height, Files[i].InputStream, 90L);
                        folderList = new string[] { "main" };
                    }
                    else
                    {
                        ImageResize.ImgResize($"{path}/other/{fileName}", bmp.Width, bmp.Height, Files[i].InputStream, 90L);

                        folderList = new string[] { "other" };
                    }

                    foreach (string item in folderList)
                    {
                        dr = dtFiles.NewRow();
                        switch (item)
                        {
                        case "main":
                            dr["NewsFilesTypesId"] = (int)Tools.NewsFilesTypes.Əsas_şəkil;
                            break;

                        case "other":
                            dr["NewsFilesTypesId"] = (int)Tools.NewsFilesTypes.Digər_şəkillər;
                            break;

                        default:
                            break;
                        }

                        dr["FilesFoldersId"] = (int)Tools.FilesFolders.Xəbərlər;
                        dr["FilesTypesId"]   = (int)(Tools.FilesTypes)Enum.Parse(typeof(Tools.FilesTypes), fileType);
                        dr["Path"]           = $"{path}/{item}/{fileName}";
                        dr["Name"]           = fileName;
                        dr["ContentLength"]  = contentLenght;

                        dtFiles.Rows.Add(dr);
                    }
                }
            }
        }

        DALC.ExecuteProcedure("InsertNewsFiles", "NewsId,ImportTableNewsFiles,CreatedDate", new object[] { _newsId, dtFiles, DateTime.Now });

        int NewsPageNum = 1;

        if (Session["NewsPageID"] != null)
        {
            NewsPageNum = int.Parse(Session["NewsPageID"].ToString());
        }

        ConfigL.RedirectURL(string.Format("/{0}/modules/news/{1}", Langs.Name, NewsPageNum));
    }
示例#10
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        ConfigL.ClearBorderColor(pnlControls);

        if (string.IsNullOrEmpty(txtTitle.Text))
        {
            ConfigL.BorderColor(txtTitle);
            return;
        }

        if (string.IsNullOrEmpty(txtNameLangs.Text))
        {
            ConfigL.BorderColor(txtNameLangs);
            return;
        }

        if (string.IsNullOrEmpty(txtMinMinute.Text))
        {
            ConfigL.BorderColor(txtMinMinute);
            return;
        }

        if (string.IsNullOrEmpty(txtDailyUse.Text))
        {
            ConfigL.BorderColor(txtDailyUse);
            return;
        }

        if (string.IsNullOrEmpty(txtUseBetweenHour.Text))
        {
            ConfigL.BorderColor(txtUseBetweenHour);
            return;
        }

        DateTime dateTime;

        if (string.IsNullOrEmpty(txtExpireDate.Text) || !Config.DateFormat(txtExpireDate.Text, out dateTime))
        {
            ConfigL.BorderColor(txtExpireDate);
            return;
        }

        if (dListStatus.SelectedValue == "-1")
        {
            ConfigL.BorderColor(dListStatus);
            return;
        }

        if (!Enum.IsDefined(typeof(Tools.ServicesTypes), _servicesTypesId))
        {
            ConfigL.MsgBoxAjax("Xidmət növü düzgün deyil!");
            return;
        }

        DALC.Transaction transaction = new DALC.Transaction();
        int check;
        var dictionaryServices = new Dictionary <string, object>()
        {
            { "MinMinute", txtMinMinute.Text },
            { "DailyUse", txtDailyUse.Text },
            { "UseBetweenHour", txtUseBetweenHour.Text },
            { "ExpireDate", dateTime },
            { "IsActive", int.Parse(dListStatus.SelectedValue) }
        };

        DataTable dtServicesLangs = new DataTable();

        dtServicesLangs.Columns.Add("ServicesId", typeof(int));
        dtServicesLangs.Columns.Add("LangsId", typeof(int));
        dtServicesLangs.Columns.Add("Name", typeof(string));
        dtServicesLangs.Columns.Add("Description", typeof(string));
        dtServicesLangs.Columns.Add("CreatedDate", typeof(DateTime));

        if (_operationsType == "add")
        {
            dictionaryServices.Add("ServicesTypesId", _servicesTypesId);
            dictionaryServices.Add("Title", txtTitle.Text);

            int resultId = DALC.InsertDatabase(Tools.Tables.Services, dictionaryServices, transaction);
            if (resultId < 1)
            {
                ConfigL.MsgBoxAjax(Config._AlertMessages.Error);
                return;
            }

            _serviceId = resultId;

            DataRow dr;
            foreach (Tools.Langs langs in (Tools.Langs[])Enum.GetValues(typeof(Tools.Langs)))
            {
                dr = dtServicesLangs.NewRow();
                dr["ServicesId"]  = _serviceId;
                dr["LangsId"]     = (int)langs;
                dr["Name"]        = txtNameLangs.Text;
                dr["Description"] = txtDescriptionLangs.Text;
                dr["CreatedDate"] = DateTime.Now;
                dtServicesLangs.Rows.Add(dr);
            }

            resultId = DALC.InsertBulk(Tools.Tables.ServicesLangs, dtServicesLangs, transaction, true);
            if (resultId < 1)
            {
                ConfigL.MsgBoxAjax(Config._AlertMessages.Error);
                return;
            }
        }
        else if (_operationsType == "edit")
        {
            dictionaryServices.Add("WhereId", _serviceId);

            check = DALC.UpdateDatabase(Tools.Tables.Services, dictionaryServices, transaction);
            if (check < 1)
            {
                ConfigL.MsgBoxAjax(Config._AlertMessages.Error);
                return;
            }

            var dictionaryServicesLangs = new Dictionary <string, object>()
            {
                { "Name", txtNameLangs.Text },
                { "Description", txtDescriptionLangs.Text },
                { "WhereServicesId", _serviceId },
                { "WhereLangsId", Langs.Id },
            };

            check = DALC.UpdateDatabase(Tools.Tables.ServicesLangs, dictionaryServicesLangs, transaction, true);
            if (check < 1)
            {
                ConfigL.MsgBoxAjax(Config._AlertMessages.Error);
                return;
            }
        }

        ConfigL.MsgBoxAjax(Config._AlertMessages.Success, $"/{Langs.Name}/modules/services/{_servicesTypesId}");
    }
示例#11
0
    protected void DListPersonsStatus_SelectedIndexChanged(object sender, EventArgs e)
    {
        ListBox DList = sender as ListBox;

        _Applicant = DList.Items.FindByValue(Tools.ListPersonsStatus.Müraciətçi.ToString("d"));
        _Private   = DList.Items.FindByValue(Tools.ListPersonsStatus.Məxfi.ToString("d"));
        _Primary   = DList.Items.FindByValue(Tools.ListPersonsStatus.Əsas_şəxs.ToString("d"));

        if (_Primary == null)
        {
            _Primary = new ListItem("Əsas şəxs", Tools.ListPersonsStatus.Əsas_şəxs.ToString("d"));
            DList.Items.Add(_Primary);
        }

        if (_Private == null)
        {
            _Private = new ListItem("Məxfi", Tools.ListPersonsStatus.Məxfi.ToString("d"));
            DList.Items.Add(_Private);
        }

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

        for (int i = 0; i < DList.Items.Count; i++)
        {
            if (DList.Items[i].Selected)
            {
                //Əgər məxfi seçilibsə əsası, əsas seçilibsə məxfini siyahıdan çıxardaq
                if (DList.Items[i].Value == Tools.ListPersonsStatus.Məxfi.ToString("d"))
                {
                    DList.Items.Remove(_Primary);
                }
                else if (DList.Items[i].Value == Tools.ListPersonsStatus.Əsas_şəxs.ToString("d"))
                {
                    DList.Items.Remove(_Private);
                }
            }
        }

        DALC.Transaction Transaction = new DALC.Transaction();
        //Əgər vetendasha  əsas statusu seçilibsə hamisi false edek...
        if (_Primary.Selected)
        {
            Dictionary.Add("IsPrimary", false);
            Dictionary.Add("WhereApplicationsID", _ApplicationsID);

            int Check = DALC.UpdateDatabase(Tools.Table.ApplicationsPersons, Dictionary, Transaction);
            if (Check < 1)
            {
                Config.MsgBoxAjax(Config._DefaultErrorMessages);
                return;
            }
        }
        Dictionary.Clear();

        //Her seçimdə bazada update edək
        Dictionary.Add("IsApplicant", _Applicant.Selected);
        Dictionary.Add("IsPrivate", _Private.Selected);
        Dictionary.Add("IsPrimary", _Primary.Selected);
        Dictionary.Add("WhereID", DList.Attributes["data-id"]);

        int Chek = DALC.UpdateDatabase(Tools.Table.ApplicationsPersons, Dictionary, Transaction, true);

        if (Chek < 1)
        {
            Config.MsgBoxAjax(Config._DefaultErrorMessages);
            return;
        }
    }
示例#12
0
    private void CalculationForFullScale()
    {
        int Internalized, Asocial, Externalized, General;

        int.TryParse(HdnFinalBox1.Value, out Internalized);
        int.TryParse(HdnFinalBox2.Value, out Asocial);
        int.TryParse(HdnFinalBox3.Value, out Externalized);
        int.TryParse(HdnFinalBox4.Value, out General);


        int AgeYear, AgeMonth;

        int.TryParse(HdnAgeYear.Value, out AgeYear);
        int.TryParse(HdnAgeMonth.Value, out AgeMonth);

        if (AgeYear >= 19)
        {
            AgeMonth = AgeYear;
        }

        if (AgeYear > 81)
        {
            AgeYear  = 81;
            AgeMonth = 81;
        }

        DALC.Transaction Transaction = new DALC.Transaction();

        #region InsertSIBRTable

        Dictionary <string, object> Dictionary = new Dictionary <string, object>
        {
            { "SIBRTypesID", (int)Tools.SIBRTypes.Full_Scale },
            { "ApplicationsPersonsID", _ApplicationsPersonsID },
            { "AgeYear", AgeYear },
            { "AgeMonth", AgeMonth },
            { "Description", TxtDescription.Text },
            { "IsCompleted", true },
            { "IsActive", true },
            { "Create_Dt", Config.DateTimeFormat(string.Format("{0}.{1}.{2}", TxtTestingDateDay.Text, TxtTestingDateMonth.Text, TxtTestingDateYear.Text)) },
            { "SIBRStatusID", (int)Tools.SIBRStatus.Aktiv },
            { "Add_Dt", DateTime.Now },
            { "Add_Ip", Request.UserHostAddress.IPToInteger() }
        };

        _Result = DALC.InsertDatabase(Tools.Table.SIBR, Dictionary, Transaction);
        if (_Result < 1)
        {
            Config.MsgBoxAjax(Config._DefaultErrorMessages);
            return;
        }

        _SIBRID = _Result;

        #endregion

        DataTable DtSIBRAdaptiveScores = new DataTable();
        DtSIBRAdaptiveScores.Columns.Add("SIBRID", typeof(int));
        DtSIBRAdaptiveScores.Columns.Add("SIBRScoringTypesID", typeof(int));
        DtSIBRAdaptiveScores.Columns.Add("SumA", typeof(int));
        DtSIBRAdaptiveScores.Columns.Add("SumB", typeof(int));
        DtSIBRAdaptiveScores.Columns.Add("SumC", typeof(int));
        DtSIBRAdaptiveScores.Columns.Add("W", typeof(int));

        DataTable DtSIBRAdaptiveResult = new DataTable();
        DtSIBRAdaptiveResult.Columns.Add("SIBRID", typeof(int));
        DtSIBRAdaptiveResult.Columns.Add("SIBRScoringTypesGroupsID", typeof(int));
        DtSIBRAdaptiveResult.Columns.Add("SumW", typeof(int));
        DtSIBRAdaptiveResult.Columns.Add("REFW", typeof(int));
        DtSIBRAdaptiveResult.Columns.Add("SEMSS", typeof(int));
        DtSIBRAdaptiveResult.Columns.Add("COLUMNS_DIFF_P", typeof(int));
        DtSIBRAdaptiveResult.Columns.Add("COLUMNS_DIFF_N", typeof(int));
        DtSIBRAdaptiveResult.Columns.Add("DIFF", typeof(int));
        DtSIBRAdaptiveResult.Columns.Add("RMI", typeof(string));
        DtSIBRAdaptiveResult.Columns.Add("SS", typeof(decimal));
        DtSIBRAdaptiveResult.Columns.Add("SS_SEM_N", typeof(int));
        DtSIBRAdaptiveResult.Columns.Add("SS_SEM_P", typeof(int));
        DtSIBRAdaptiveResult.Columns.Add("PR", typeof(decimal));
        DtSIBRAdaptiveResult.Columns.Add("SIBRAdaptiveSkillLevelsID", typeof(int));

        int     SumA, SumB, SumC, SIBRScoringTypesID, RawScore, W;
        decimal MS = 0, SC = 0, PL = 0, CL = 0, BI = 0;

        foreach (RepeaterItem item in RptAdaptive.Items)
        {
            if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
            {
                int.TryParse(((TextBox)item.FindControl("TxtSumA")).Text, out SumA);
                int.TryParse(((TextBox)item.FindControl("TxtSumB")).Text, out SumB);
                int.TryParse(((TextBox)item.FindControl("TxtSumC")).Text, out SumC);
                int.TryParse(((HiddenField)item.FindControl("HdnSIBRScoringTypes")).Value, out SIBRScoringTypesID);
                int.TryParse(((HiddenField)PnlRawScore.FindControl(string.Format("HdnRawScore{0}", SIBRScoringTypesID))).Value, out RawScore);

                DataTable Dt = DALC.GetSIBRScoring(Tools.SIBRTypes.Full_Scale, SIBRScoringTypesID, RawScore);

                if (Dt == null)
                {
                    TransactionRollBack(Transaction);
                    Config.MsgBoxAjax(Config._DefaultErrorMessages);
                    return;
                }

                if (Dt.Rows.Count < 1)
                {
                    TransactionRollBack(Transaction);
                    Config.MsgBoxAjax(string.Format("{0}: RawScore dəyəri {1} uyğun məlumat tapılmadı.", ((Tools.SIBRScoringTypes)Enum.Parse(typeof(Tools.SIBRScoringTypes), SIBRScoringTypesID.ToString())).ToDescriptionString(), RawScore));
                    return;
                }

                W = int.Parse(Dt._Rows("W"));

                //Burda baxiriqki  SIBRScoringTypesID hansi SIBRScoringTypesGroups-a aiddirse ona uygun emeliyyat apaririq
                if (Tools.SIBRScoringTypesGroups.Motor_Skills.ToDescriptionString().Contains(string.Format(",{0},", SIBRScoringTypesID)))
                {
                    MS += W;
                }
                else if (Tools.SIBRScoringTypesGroups.Social_Interaction_Communication_Skills.ToDescriptionString().Contains(string.Format(",{0},", SIBRScoringTypesID)))
                {
                    SC += W;
                }
                else if (Tools.SIBRScoringTypesGroups.Personal_Living_Skills.ToDescriptionString().Contains(string.Format(",{0},", SIBRScoringTypesID)))
                {
                    PL += W;
                }
                else if (Tools.SIBRScoringTypesGroups.Community_Living_Skills.ToDescriptionString().Contains(string.Format(",{0},", SIBRScoringTypesID)))
                {
                    CL += W;
                }

                DtSIBRAdaptiveScores.Rows.Add(_SIBRID, SIBRScoringTypesID, SumA, SumB, SumC, W);
            }
        }

        MS = Math.Round(MS / 2);
        SC = Math.Round(SC / 3);
        PL = Math.Round(PL / 5);
        CL = Math.Round(CL / 4);
        BI = Math.Round((MS + SC + PL + CL) / 4);


        //Short ve Early Development Form xaric hamisini getirek
        DataTable DtNormF = DALC.GetSIBRNormFForFullScale(AgeYear, AgeMonth);

        if (DtNormF == null || DtNormF.Rows.Count < 1)
        {
            TransactionRollBack(Transaction);
            Config.MsgBoxAjax("Norm F cədvəlindən uyğun məlumat tapılmadı.");
            return;
        }


        decimal SumW = 0, REFW = 0, DIFF = 0;
        int     SEMSS = 0, COLUMNS_DIFF_P = 0, COLUMNS_DIFF_N = 0;
        int     SS = 0, SS_SEM_N = 0, SS_SEM_P = 0;
        int     SIBRAdaptiveSkillLevelsID;
        string  RMI = "";
        decimal PR  = 0;
        int     SIBRScoringTypesGroupsID = 0;

        foreach (DataRow Dr in DtNormF.Rows)
        {
            REFW           = Dr["REFW"]._ToInt32();
            SEMSS          = Dr["SEMSS"]._ToInt32();
            COLUMNS_DIFF_P = Dr["DIFF_P"]._ToInt32();
            COLUMNS_DIFF_N = Dr["DIFF_N"]._ToInt32();

            if (Dr["SIBRNormFTypesID"]._ToInt16() == (int)Tools.SIBRNormFTypes.Motor_Skills)
            {
                SumW = MS;
                DIFF = MS - REFW;
                SIBRScoringTypesGroupsID = (int)Tools.SIBRScoringTypesGroups.Motor_Skills;
            }
            else if (Dr["SIBRNormFTypesID"]._ToInt16() == (int)Tools.SIBRNormFTypes.Social_Interaction_Communication_Skills)
            {
                SumW = SC;
                DIFF = SC - REFW;
                SIBRScoringTypesGroupsID = (int)Tools.SIBRScoringTypesGroups.Social_Interaction_Communication_Skills;
            }
            else if (Dr["SIBRNormFTypesID"]._ToInt16() == (int)Tools.SIBRNormFTypes.Personal_Living_Skills)
            {
                SumW = PL;
                DIFF = PL - REFW;
                SIBRScoringTypesGroupsID = (int)Tools.SIBRScoringTypesGroups.Personal_Living_Skills;
            }
            else if (Dr["SIBRNormFTypesID"]._ToInt16() == (int)Tools.SIBRNormFTypes.Community_Living_Skills)
            {
                SumW = CL;
                DIFF = CL - REFW;
                SIBRScoringTypesGroupsID = (int)Tools.SIBRScoringTypesGroups.Community_Living_Skills;
            }
            else if (Dr["SIBRNormFTypesID"]._ToInt16() == (int)Tools.SIBRNormFTypes.Broad_Independence)
            {
                SumW = BI;
                DIFF = BI - REFW;
                SIBRScoringTypesGroupsID = (int)Tools.SIBRScoringTypesGroups.Broad_Independence_Full_Scale;
            }

            DataTable DtNormG = new DataTable();
            if (DIFF >= 0)
            {
                DtNormG = DALC.GetSIBRNormG(COLUMNS_DIFF_P, DIFF._ToInt32());
            }
            else
            {
                DtNormG = DALC.GetSIBRNormG(COLUMNS_DIFF_N, DIFF._ToInt32());
            }

            if (DtNormG == null || DtNormG.Rows.Count < 1)
            {
                TransactionRollBack(Transaction);
                Config.MsgBoxAjax("Norm G cədvəlindən uyğun məlumat tapılmadı.");
                return;
            }


            RMI      = DtNormG._Rows("RMI");
            SS       = DtNormG._RowsObject("SS")._ToInt32();
            SS_SEM_N = SS - SEMSS;
            SS_SEM_P = SS + SEMSS;
            PR       = Convert.ToDecimal(DtNormG._RowsObject("PR"));

            SIBRAdaptiveSkillLevelsID = DALC.GetSIBRAdaptiveSkillLevels(DIFF._ToInt32());

            if (SIBRAdaptiveSkillLevelsID == -1)
            {
                TransactionRollBack(Transaction);
                Config.MsgBoxAjax("Adaptive Behavior Skill Levels cədvəlindən məlumat tapılmadı.");
                return;
            }
            DtSIBRAdaptiveResult.Rows.Add(_SIBRID,
                                          SIBRScoringTypesGroupsID,
                                          SumW,
                                          REFW,
                                          SEMSS,
                                          COLUMNS_DIFF_P,
                                          COLUMNS_DIFF_N,
                                          DIFF,
                                          RMI,
                                          SS,
                                          SS_SEM_N,
                                          SS_SEM_P,
                                          PR,
                                          SIBRAdaptiveSkillLevelsID);
        }


        _Result = DALC.InsertBulk(Tools.Table.SIBRAdaptiveScores, DtSIBRAdaptiveScores, Transaction);
        if (_Result < 1)
        {
            Config.MsgBoxAjax(Config._DefaultErrorMessages);
            return;
        }

        _Result = DALC.InsertBulk(Tools.Table.SIBRAdaptiveResult, DtSIBRAdaptiveResult, Transaction);
        if (_Result < 1)
        {
            Config.MsgBoxAjax(Config._DefaultErrorMessages);
            return;
        }

        DataTable DtSIBRNormI = DALC.GetSIBRNomrIForBroadIndependence(Tools.SIBRNormITypes.Broad_Independence_W, BI._ToInt32(), General);

        if (DtSIBRNormI == null)
        {
            TransactionRollBack(Transaction);
            Config.MsgBoxAjax(Config._DefaultErrorMessages);
            return;
        }

        if (DtSIBRNormI.Rows.Count < 1)
        {
            TransactionRollBack(Transaction);
            Config.MsgBoxAjax("Norm I cədvəlindən uyğun məlumat tapılmadı.");
            return;
        }

        int SupportScore = DtSIBRNormI._Rows("Value")._ToInt32();

        Dictionary <string, object> DicMaladaptive = new Dictionary <string, object>()
        {
            { "SIBRID", _SIBRID },
            { "Internalized", Internalized },
            { "Asocial", Asocial },
            { "Externalized", Externalized },
            { "General", General },
            { "SupportScore", SupportScore }
        };

        _Result = DALC.InsertDatabase(Tools.Table.SIBRMaladaptiveScores, DicMaladaptive, Transaction);
        if (_Result < 1)
        {
            Config.MsgBoxAjax(Config._DefaultErrorMessages);
            return;
        }

        DataTable DtDetailsTypes = DALC.GetList(Tools.Table.SIBRMaladaptiveScoresDetailsTypes, "");
        if (DtDetailsTypes == null || DtDetailsTypes.Rows.Count < 1)
        {
            TransactionRollBack(Transaction);
            Config.MsgBoxAjax(Config._DefaultErrorMessages);
            return;
        }

        DataTable DtMaladaptiveScoresDetails = new DataTable();
        DtMaladaptiveScoresDetails.Columns.Add("SIBRMaladaptiveScoresID", typeof(int));
        DtMaladaptiveScoresDetails.Columns.Add("SIBRMaladaptiveScoresDetailsTypesID", typeof(byte));
        DtMaladaptiveScoresDetails.Columns.Add("FrequencyRaiting", typeof(byte));
        DtMaladaptiveScoresDetails.Columns.Add("SeverityRaiting", typeof(byte));


        int  x = 1, y = 2;
        byte Frequency, Severity;
        foreach (DataRow Dr in DtDetailsTypes.Rows)
        {
            if (!byte.TryParse(((TextBox)PnlProblemBehavior.FindControl(string.Format("Txt{0}", x))).Text, out Frequency) ||
                !byte.TryParse(((TextBox)PnlProblemBehavior.FindControl(string.Format("Txt{0}", y))).Text, out Severity))
            {
                TransactionRollBack(Transaction);
                Config.MsgBoxAjax("Problem Behavior dəyərlərini düzgün qeyd edin!");
                return;
            }

            DtMaladaptiveScoresDetails.Rows.Add(_Result, Convert.ToByte(Dr["ID"]), Frequency, Severity);
        }

        _Result = DALC.InsertBulk(Tools.Table.SIBRMaladaptiveScoresDetails, DtMaladaptiveScoresDetails, Transaction);
        if (_Result < 1)
        {
            Config.MsgBoxAjax(Config._DefaultErrorMessages);
            return;
        }

        Dictionary <string, object> AddServicesDictionary = new Dictionary <string, object>();
        AddServicesDictionary.Add("ApplicationsPersonsID", _ApplicationsPersonsID);
        AddServicesDictionary.Add("ServicesID", (int)Tools.Services.SIB_R_tam_miqyaslı_forma);
        AddServicesDictionary.Add("ApplicationsPersonsServicesStatusID", (int)Tools.ApplicationsPersonsServicesStatus.Həll_olunub_təmin_edilib);
        AddServicesDictionary.Add("IsFirstApplication", false);
        AddServicesDictionary.Add("IsActive", true);
        AddServicesDictionary.Add("Add_Dt", DateTime.Now);
        AddServicesDictionary.Add("Add_Ip", Request.UserHostAddress.IPToInteger());

        _Result = DALC.InsertDatabase(Tools.Table.ApplicationsPersonsServices, AddServicesDictionary, Transaction, true);
        if (_Result < 1)
        {
            Config.MsgBoxAjax(Config._DefaultErrorMessages);
            return;
        }

        Config.RedirectURL(string.Format("/tools/sib-r/result/?i={0}&id={1}", Cryptography.Encrypt(string.Format("{0}-{1}-{2}", _ApplicationsID, _ApplicationsPersonsID, DALC._GetUsersLogin.Key)), Cryptography.Encrypt(_SIBRID._ToString())));
    }
示例#13
0
    //davam etmek lazimdir
    private void CalculationByTypes(Tools.SIBRTypes SIBRTypes)
    {
        Tools.SIBRNormFTypes SIBRNormFTypes = Tools.SIBRNormFTypes.Early_Development_Form;
        Tools.SIBRNormITypes SIBRNormITypes = Tools.SIBRNormITypes.Early_Development_Form_W;

        if (SIBRTypes == Tools.SIBRTypes.Short_Form)
        {
            SIBRNormFTypes = Tools.SIBRNormFTypes.Short_Form;
            SIBRNormITypes = Tools.SIBRNormITypes.Short_Form_W;
        }

        int Internalized, Asocial, Externalized, General;

        int.TryParse(HdnFinalBox1.Value, out Internalized);
        int.TryParse(HdnFinalBox2.Value, out Asocial);
        int.TryParse(HdnFinalBox3.Value, out Externalized);
        int.TryParse(HdnFinalBox4.Value, out General);


        int AgeYear, AgeMonth;

        int.TryParse(HdnAgeYear.Value, out AgeYear);
        int.TryParse(HdnAgeMonth.Value, out AgeMonth);

        if (AgeYear >= 19)
        {
            AgeMonth = AgeYear;
        }

        if (AgeYear > 81)
        {
            AgeYear  = 81;
            AgeMonth = 81;
        }

        DALC.Transaction Transaction = new DALC.Transaction();

        Dictionary <string, object> DictionarySIBR = new Dictionary <string, object>
        {
            { "SIBRTypesID", (int)SIBRTypes },
            { "ApplicationsPersonsID", _ApplicationsPersonsID },
            { "AgeYear", AgeYear },
            { "AgeMonth", AgeMonth },
            { "Description", TxtDescription.Text },
            { "IsCompleted", true },
            { "IsActive", true },
            { "Create_Dt", Config.DateTimeFormat(string.Format("{0}.{1}.{2}", TxtTestingDateDay.Text, TxtTestingDateMonth.Text, TxtTestingDateYear.Text)) },
            { "SIBRStatusID", (int)Tools.SIBRStatus.Aktiv },
            { "Add_Dt", DateTime.Now },
            { "Add_Ip", Request.UserHostAddress.IPToInteger() }
        };

        _Result = DALC.InsertDatabase(Tools.Table.SIBR, DictionarySIBR, Transaction);
        if (_Result < 1)
        {
            Config.MsgBoxAjax(Config._DefaultErrorMessages);
            return;
        }

        _SIBRID = _Result;

        int     Page2SumA, Page2SumB, Page2SumC, Page3SumA, Page3SumB, Page3SumC, SumA, SumB, SumC, SIBRScoringTypesID, RawScore, W;
        decimal BI = 0;

        int.TryParse(TxtPage2SumA.Text, out Page2SumA);
        int.TryParse(TxtPage2SumB.Text, out Page2SumB);
        int.TryParse(TxtPage2SumC.Text, out Page2SumC);

        int.TryParse(TxtPage3SumA.Text, out Page3SumA);
        int.TryParse(TxtPage3SumB.Text, out Page3SumB);
        int.TryParse(TxtPage3SumC.Text, out Page3SumC);

        SumA = Page2SumA + Page3SumA;
        SumB = Page2SumB + Page3SumB;
        SumC = Page2SumC + Page3SumC;

        SIBRScoringTypesID = (int)Tools.SIBRScoringTypes.Broad_Independence;

        int.TryParse(LblTotalRawScore.Text, out RawScore);

        W  = DALC.GetSIBRScoring(SIBRTypes, SIBRScoringTypesID, RawScore)._RowsInt("W");
        BI = W;
        Dictionary <string, object> DicSIBRAdaptiveScores = new Dictionary <string, object>
        {
            { "SIBRID", _SIBRID },
            { "SIBRScoringTypesID", SIBRScoringTypesID },
            { "SumA", SumA },
            { "SumB", SumB },
            { "SumC", SumC },
            { "W", W },
        };

        DataTable DtNormF = DALC.GetSIBRNormFByTypesID(SIBRNormFTypes, AgeYear, AgeMonth);

        if (DtNormF == null || DtNormF.Rows.Count < 1)
        {
            TransactionRollBack(Transaction);
            Config.MsgBoxAjax("Norm F cədvəlindən uyğun məlumat tapılmadı.");
            return;
        }

        decimal SumW = 0, REFW = 0, DIFF = 0;
        int     SEMSS = 0, COLUMNS_DIFF_P = 0, COLUMNS_DIFF_N = 0;
        int     SS = 0, SS_SEM_N = 0, SS_SEM_P = 0;
        int     SIBRAdaptiveSkillLevelsID;
        string  RMI = "";
        decimal PR  = 0;
        int     SIBRScoringTypesGroupsID = 0;

        try
        {
            SumW           = W;
            REFW           = DtNormF._RowsInt("REFW");
            SEMSS          = DtNormF._RowsInt("SEMSS");
            COLUMNS_DIFF_P = DtNormF._RowsInt("DIFF_P");
            COLUMNS_DIFF_N = DtNormF._RowsInt("DIFF_N");
            DIFF           = W - REFW;
        }
        catch
        {
            TransactionRollBack(Transaction);
            Config.MsgBoxAjax(Config._DefaultErrorMessages);
            return;
        }


        SIBRScoringTypesGroupsID = (int)Tools.SIBRScoringTypesGroups.Broad_Independence_Full_Scale;

        DataTable DtNormG = new DataTable();

        if (DIFF >= 0)
        {
            DtNormG = DALC.GetSIBRNormG(COLUMNS_DIFF_P, DIFF._ToInt32());
        }
        else
        {
            DtNormG = DALC.GetSIBRNormG(COLUMNS_DIFF_N, DIFF._ToInt32());
        }

        if (DtNormG == null || DtNormG.Rows.Count < 1)
        {
            TransactionRollBack(Transaction);
            Config.MsgBoxAjax("Norm G cədvəlindən uyğun məlumat tapılmadı.");
            return;
        }

        RMI      = DtNormG._Rows("RMI");
        SS       = DtNormG._RowsObject("SS")._ToInt32();
        SS_SEM_N = SS - SEMSS;
        SS_SEM_P = SS + SEMSS;
        PR       = Convert.ToDecimal(DtNormG._RowsObject("PR"));

        SIBRAdaptiveSkillLevelsID = DALC.GetSIBRAdaptiveSkillLevels(DIFF._ToInt32());

        if (SIBRAdaptiveSkillLevelsID == -1)
        {
            TransactionRollBack(Transaction);
            Config.MsgBoxAjax("Adaptive Behavior Skill Levels cədvəlindən məlumat tapılmadı.");
            return;
        }

        Dictionary <string, object> DicSIBRAdaptiveResult = new Dictionary <string, object>
        {
            { "SIBRID", _SIBRID },
            { "SIBRScoringTypesGroupsID", SIBRScoringTypesGroupsID },
            { "SumW", SumW },
            { "REFW", REFW },
            { "SEMSS", SEMSS },
            { "COLUMNS_DIFF_P", COLUMNS_DIFF_P },
            { "COLUMNS_DIFF_N", COLUMNS_DIFF_N },
            { "DIFF", DIFF },
            { "RMI", RMI },
            { "SS", SS },
            { "SS_SEM_N", SS_SEM_N },
            { "SS_SEM_P", SS_SEM_P },
            { "PR", PR },
            { "SIBRAdaptiveSkillLevelsID", SIBRAdaptiveSkillLevelsID }
        };

        _Result = DALC.InsertDatabase(Tools.Table.SIBRAdaptiveScores, DicSIBRAdaptiveScores, Transaction);
        if (_Result < 1)
        {
            Config.MsgBoxAjax(Config._DefaultErrorMessages);
            return;
        }

        _Result = DALC.InsertDatabase(Tools.Table.SIBRAdaptiveResult, DicSIBRAdaptiveResult, Transaction);
        if (_Result < 1)
        {
            Config.MsgBoxAjax(Config._DefaultErrorMessages);
            return;
        }

        DataTable DtSIBRNormI = DALC.GetSIBRNomrIForBroadIndependence(SIBRNormITypes, W, General);

        if (DtSIBRNormI == null)
        {
            TransactionRollBack(Transaction);
            Config.MsgBoxAjax(Config._DefaultErrorMessages);
            return;
        }

        if (DtSIBRNormI.Rows.Count < 1)
        {
            TransactionRollBack(Transaction);
            Config.MsgBoxAjax("Norm I cədvəlindən uyğun məlumat tapılmadı.");
            return;
        }

        int SupportScore = DtSIBRNormI._Rows("Value")._ToInt32();

        Dictionary <string, object> DicMaladaptive = new Dictionary <string, object>()
        {
            { "SIBRID", _SIBRID },
            { "Internalized", Internalized },
            { "Asocial", Asocial },
            { "Externalized", Externalized },
            { "General", General },
            { "SupportScore", SupportScore }
        };

        _Result = DALC.InsertDatabase(Tools.Table.SIBRMaladaptiveScores, DicMaladaptive, Transaction);
        if (_Result < 1)
        {
            Config.MsgBoxAjax(Config._DefaultErrorMessages);
            return;
        }

        DataTable DtDetailsTypes = DALC.GetList(Tools.Table.SIBRMaladaptiveScoresDetailsTypes, "");

        if (DtDetailsTypes == null || DtDetailsTypes.Rows.Count < 1)
        {
            TransactionRollBack(Transaction);
            Config.MsgBoxAjax(Config._DefaultErrorMessages);
            return;
        }

        DataTable DtMaladaptiveScoresDetails = new DataTable();

        DtMaladaptiveScoresDetails.Columns.Add("SIBRMaladaptiveScoresID", typeof(int));
        DtMaladaptiveScoresDetails.Columns.Add("SIBRMaladaptiveScoresDetailsTypesID", typeof(byte));
        DtMaladaptiveScoresDetails.Columns.Add("FrequencyRaiting", typeof(byte));
        DtMaladaptiveScoresDetails.Columns.Add("SeverityRaiting", typeof(byte));


        int  x = 1, y = 2;
        byte Frequency, Severity;

        foreach (DataRow Dr in DtDetailsTypes.Rows)
        {
            if (!byte.TryParse(((TextBox)PnlProblemBehavior.FindControl(string.Format("Txt{0}", x))).Text, out Frequency) ||
                !byte.TryParse(((TextBox)PnlProblemBehavior.FindControl(string.Format("Txt{0}", y))).Text, out Severity))
            {
                TransactionRollBack(Transaction);
                Config.MsgBoxAjax("Problem Behavior dəyərlərini düzgün qeyd edin!");
                return;
            }

            DtMaladaptiveScoresDetails.Rows.Add(_Result, Convert.ToByte(Dr["ID"]), Frequency, Severity);
        }

        _Result = DALC.InsertBulk(Tools.Table.SIBRMaladaptiveScoresDetails, DtMaladaptiveScoresDetails, Transaction);
        if (_Result < 1)
        {
            Config.MsgBoxAjax(Config._DefaultErrorMessages);
            return;
        }

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

        AddServicesDictionary.Add("ApplicationsPersonsID", _ApplicationsPersonsID);
        AddServicesDictionary.Add("ServicesID", (int)Tools.Services.SIB_R_tam_miqyaslı_forma);
        AddServicesDictionary.Add("ApplicationsPersonsServicesStatusID", (int)Tools.ApplicationsPersonsServicesStatus.Həll_olunub_təmin_edilib);
        AddServicesDictionary.Add("IsFirstApplication", false);
        AddServicesDictionary.Add("IsActive", true);
        AddServicesDictionary.Add("Add_Dt", DateTime.Now);
        AddServicesDictionary.Add("Add_Ip", Request.UserHostAddress.IPToInteger());

        _Result = DALC.InsertDatabase(Tools.Table.ApplicationsPersonsServices, AddServicesDictionary, Transaction, true);
        if (_Result < 1)
        {
            Config.MsgBoxAjax(Config._DefaultErrorMessages);
            return;
        }

        Config.RedirectURL(string.Format("/tools/sib-r/result/?i={0}&id={1}", Cryptography.Encrypt(string.Format("{0}-{1}-{2}", _ApplicationsID, _ApplicationsPersonsID, DALC._GetUsersLogin.Key)), Cryptography.Encrypt(_SIBRID._ToString())));
    }