Пример #1
0
    protected void LnkAnswer_Click(object sender, EventArgs e)
    {
        //Icindekileri deaktiv edek.
        LinkButton Lnk = sender as LinkButton;

        Repeater Rpt = (Repeater)Lnk.Parent.Parent;

        for (int i = 0; i < Rpt.Items.Count; i++)
        {
            ((LinkButton)Rpt.Items[i].Controls[1]).CssClass = "list-group-item answerEvo";
        }

        int Point = int.Parse(Lnk.CommandArgument);

        Lnk.CssClass = "list-group-item answerActive";
        int EvaluationsQuestionsID = int.Parse(Lnk.CommandName);

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

        //Eger yeni gelibse ve Evaluations table-inda yoxdursa insert edek
        if (_EvaluationsID == 0)
        {
            Dictionary = new Dictionary <string, object>()
            {
                { "ApplicationsPersonsID", _ApplicationsPersonsID },
                { "PointSum", 0 },
                { "IsCompleted", false },
                { "IsActive", true },
                { "Add_Dt", DateTime.Now },
                { "Add_Ip", Request.UserHostAddress.IPToInteger() }
            };

            _Result = DALC.InsertDatabase(Tools.Table.Evaluations, Dictionary);
            if (_Result < 1)
            {
                Config.MsgBoxAjax(Config._DefaultErrorMessages);
                return;
            }
            _EvaluationsID            = _Result;
            Session["_EvaluationsID"] = _EvaluationsID;
        }

        Dictionary = new Dictionary <string, object>()
        {
            { "EvaluationsID", _EvaluationsID },
            { "EvaluationsQuestionsID", EvaluationsQuestionsID },
            { "Point", Point },
            { "Description", DBNull.Value }
        };

        string EvaluationsPointsID = DALC.CheckEvaluationsPoints(_EvaluationsID, EvaluationsQuestionsID);

        if (!string.IsNullOrEmpty(EvaluationsPointsID))
        {
            //Her defe bura update gedende Trg_EvaluationsPoints le Evaluations table-da PointSum update olur
            Dictionary.Add("WhereID", int.Parse(EvaluationsPointsID));
            _Result = DALC.UpdateDatabase(Tools.Table.EvaluationsPoints, Dictionary);
        }
        else
        {
            //Her defe bura insert gedende Trg_EvaluationsPoints le Evaluations table-da PointSum update-le artir
            _Result             = DALC.InsertDatabase(Tools.Table.EvaluationsPoints, Dictionary);
            EvaluationsPointsID = _Result._ToString();
        }


        if (_Result < 1)
        {
            Config.MsgBoxAjax(Config._DefaultErrorMessages);
            return;
        }
    }