protected void RadScheduler1_FormCreated(object sender, Telerik.Web.UI.SchedulerFormCreatedEventArgs e) { string UserID = (string)Session["UserID"].ToString(); //string UserID = "27276"; if (UserID == null) { Response.Redirect("http://portal.footgear.com.vn/"); } else { if (e.Container.Mode == SchedulerFormMode.Insert) { Status = "Insert"; } if (e.Container.Mode == SchedulerFormMode.AdvancedInsert) { Status = "AdvancedInsert"; RadDateTimePicker startInput = (RadDateTimePicker)e.Container.FindControl("StartInput"); RadDateTimePicker endInput = (RadDateTimePicker)e.Container.FindControl("EndInput"); startInput.SelectedDate = e.Appointment.Start; endInput.SelectedDate = e.Appointment.End; } if (e.Container.Mode == SchedulerFormMode.AdvancedEdit) { HiddenField hdffID = ((HiddenField)e.Container.FindControl("hdfID")); hdffID.Value = e.Appointment.ID.ToString(); DataTable dt = dal.QryTheoTheoID(int.Parse(hdffID.Value)); TextBox subjectBox = (TextBox)e.Container.FindControl("SubjectTextBox"); subjectBox.Text = e.Appointment.Subject; RadDateTimePicker startInput = (RadDateTimePicker)e.Container.FindControl("StartInput"); startInput.SelectedDate = RadScheduler1.DisplayToUtc(e.Appointment.Start); RadDateTimePicker endInput = (RadDateTimePicker)e.Container.FindControl("EndInput"); endInput.SelectedDate = RadScheduler1.DisplayToUtc(e.Appointment.End); RadTextBox txtDescription = (RadTextBox)e.Container.FindControl("txtDescription"); txtDescription.Text = e.Appointment.Description; RadTextBox txtLink = (RadTextBox)e.Container.FindControl("txtLink"); RadNumericTextBox txtPhanTram = (RadNumericTextBox)e.Container.FindControl("txtPhanTram"); OCanlendar objec = new OCanlendar(); txtLink.Text = dt.Rows[0]["wklink"].ToString(); txtPhanTram.Text = dt.Rows[0]["jobpercent"].ToString(); } } }
protected void RadScheduler1_FormCreated(object sender, Telerik.Web.UI.SchedulerFormCreatedEventArgs e) { if (e.Container.Mode == SchedulerFormMode.Insert) { Status = "Insert"; } if (e.Container.Mode == SchedulerFormMode.AdvancedInsert) { Status = "AdvancedInsert"; RadDateTimePicker startInput = (RadDateTimePicker)e.Container.FindControl("StartInput"); //startInput.SelectedDate = DateTime.Parse(hdf.Value); RadDateTimePicker endInput = (RadDateTimePicker)e.Container.FindControl("EndInput"); //endInput.SelectedDate = DateTime.Parse(hdf.Value); //-- Kiểm tra quyền tạo việc BUser ctl = new BUser(); Panel panelUser = (Panel)e.Container.FindControl("panelUser"); if (ctl.HasPermission(Global.UserInfo.UserID, PermissionCode.CalendarCreate.ToString()) || Global.IsAdmin()) { panelUser.Visible = true; } else { panelUser.Visible = false; } } if (e.Container.Mode == SchedulerFormMode.AdvancedEdit) { HiddenField hdfID = ((HiddenField)e.Container.FindControl("hdfID")); hdfID.Value = e.Appointment.ID.ToString(); TextBox subjectBox = (TextBox)e.Container.FindControl("SubjectTextBox"); subjectBox.Text = e.Appointment.Subject; RadDateTimePicker startInput = (RadDateTimePicker)e.Container.FindControl("StartInput"); //startInput. = RadScheduler1.EditFormDateFormat + " " + RadScheduler1.EditFormTimeFormat; startInput.SelectedDate = RadScheduler1.DisplayToUtc(e.Appointment.Start); RadDateTimePicker endInput = (RadDateTimePicker)e.Container.FindControl("EndInput"); //endInput.DateFormat = RadScheduler1.EditFormDateFormat + " " + RadScheduler1.EditFormTimeFormat; endInput.SelectedDate = RadScheduler1.DisplayToUtc(e.Appointment.End); TextBox txtDescription = (TextBox)e.Container.FindControl("txtDescription"); txtDescription.Text = e.Appointment.Description; TextBox txtAddress = (TextBox)e.Container.FindControl("txtAddress"); BCalendar BCaledarobj = new BCalendar(); OCalendar objCalendar = new OCalendar(); objCalendar = BCaledarobj.Get(int.Parse(e.Appointment.ID.ToString())).First(); //Lấy danh sách người tham gia BUser BobjUser = new BUser(); OUser objUser = new OUser(); string[] listUser; Panel panelUser = (Panel)e.Container.FindControl("panelUser"); string html = ""; html += "<table width='100%'>"; int count = 0; string UserJoin = objCalendar.UserJoin; listUser = UserJoin.Split(','); for (int i = 1; i < listUser.Count() - 1; i++) { OUser _OUser = new OUser(); _OUser = BobjUser.Get(listUser[i]).First(); if (count % 4 == 0) { html += "<tr>"; } html += "<td width='25%'>"; html += "<input id='ckxUser' class='cbxUser' name='ckxUser' type='checkbox' value='" + _OUser.UserName + "' title='" + _OUser.FullName + "'" + "checked='checked'" + " />"; html += " "; html += "" + _OUser.FullName + ""; html += "</td>"; count++; if (count % 4 == 0) { html += "</tr>"; } } if (count % 4 != 0) { html += "</tr>"; } html += "</table>"; Literal LiteralUser = (Literal)e.Container.FindControl("LiteralUser"); LiteralUser.Text = html; HiddenField hdfUserJoin = (HiddenField)e.Container.FindControl("hdfUserJoin"); hdfUserJoin.Value = UserJoin; //Lấy địa chỉ họp txtAddress.Text = objCalendar.Address; //-- Kiểm tra quyền tạo việc BUser ctl = new BUser(); if (ctl.HasPermission(Global.UserInfo.UserID, PermissionCode.CalendarCreate.ToString()) || Global.IsAdmin()) { panelUser.Visible = true; } else { panelUser.Visible = false; } } }