Esempio n. 1
0
    protected void BtnAddLessons_Click(object sender, EventArgs e)
    {
        if (DListServicesCoursesPlans.SelectedValue == "-1")
        {
            Config.MsgBoxAjax("Mövzunu seçin!");
            return;
        }

        if (DListTeacherUsers.SelectedValue == "-1")
        {
            Config.MsgBoxAjax("Müəllim seçin!");
            return;
        }

        object Date = Config.DateTimeFormat(TxtCreate_Dt.Text);

        if (Date == null)
        {
            Config.MsgBoxAjax("Tarixi düzgün qeyd edin.");
            return;
        }
        TxtCreate_Dt.Text = ((DateTime)Date).ToString("dd.MM.yyyy");

        int ServicesCoursesID = int.Parse(BtnAddLessons.CommandArgument);

        //Check
        int Count = DALC.CheckServicesCoursesLessons(ServicesCoursesID, ((DateTime)Date).ToString("yyyy-MM-dd"));

        if (Count == -1)
        {
            Config.MsgBoxAjax(Config._DefaultErrorMessages);
            return;
        }

        if (Count > 0)
        {
            Config.MsgBoxAjax("Bu tarixdə dərs yaradılıb!");
            return;
        }

        int ServicesCoursesLessonsID = DALC.ExecuteProcedure("InsertServicesCoursesLessons",
                                                             "ServicesCoursesID,ServicesCoursesPlansID,TeacherUsersID,Create_Dt,Description,Date,Add_Ip",
                                                             new object[]
        {
            ServicesCoursesID,
            int.Parse(DListServicesCoursesPlans.SelectedValue),
            int.Parse(DListTeacherUsers.SelectedValue),
            Date,
            TxtDescription.Text,
            DateTime.Now,
            Request.UserHostAddress.IPToInteger()
        });

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

        Config.MsgBoxAjax("Dərsə başladınız", string.Format("/tools/electronicregistry/lessons/?i={0}", (BtnAddLessons.CommandArgument + "-" + ServicesCoursesLessonsID + "-" + DALC._GetUsersLogin.Key).Encrypt()));
    }