Ejemplo n.º 1
0
 protected void grvData_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e)
 {
     try
     {
         long id = long.Parse(grvData.GetRowValues(e.VisibleIndex, grvData.KeyFieldName).ToString());
         if (e.ButtonID == "GridEdit")
         {
             BUS.BUS_MyContest obj = new BUS.BUS_MyContest();
             obj.ContestId = id;
             obj.Insert();
             HELPER.Client.Alert(this, "Đã nộp yêu cầu!");
             //   Response.Redirect(Request.RawUrl);
         }
     }
     catch (Exception ex)
     {
         HELPER.Client.Alert(this, "Bạn đã nộp yêu cầu vào khóa học này rồi! " + ex.ToString());
     }
 }
Ejemplo n.º 2
0
        void accept(List <Object> selectItemsID)
        {
            DatabaseDAO dao = new DatabaseDAO();

            objMyContest = new BUS.BUS_MyContest(dao);
            BUS.BUS_Notification   objNoti   = new BUS.BUS_Notification(dao);
            BUS.BUS_MyNotification objMyNoti = new BUS.BUS_MyNotification(dao);
            try
            {
                long acceptBy = CGlobal.GetUserID();

                if (selectItemsID.Count <= 0)
                {
                    HELPER.Client.Alert(this, "Bạn chưa chọn đơn nào!");
                }
                else
                {
                    dao.BeginTransaction();
                    long idNoti = objNoti.Insert(acceptBy, "Đã phê duyệt đơn xin vào khóa học của bạn", 3);
                    foreach (object selectItemId in selectItemsID)
                    {
                        string[] re          = selectItemId.ToString().Split('|');
                        long     idMyContest = long.Parse(re[0]);
                        long     userId      = long.Parse(re[1]);
                        objMyContest.UpdateAcepted(idMyContest, acceptBy);
                        objMyNoti.Insert(idNoti, userId);
                    }
                    dao.EndTransaction();

                    Response.Redirect(Request.RawUrl, false);
                }
            }
            catch (Exception ex)
            {
                dao.RollBack();
                HELPER.Client.Alert(this, "Lỗi cập nhật CSDL! " + ex.Message);
            }
        }