Files
ayanova7/source/WBI/FollowUpSelector.aspx.cs
2018-06-29 19:47:36 +00:00

89 lines
2.9 KiB
C#

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using GZTW.AyaNova.BLL;
public partial class FollowUpSelector : BaseThemePage
{
//---------------------------------------------------------
protected void Page_Load(object sender, EventArgs e)
{
if (AyaBizUtils.Right("Object.ScheduleMarker") < (int)SecurityLevelTypes.ReadOnly)
{
Util.Denied(Context);
}
LoadCombo();
if (AyaBizUtils.Right("Object.ScheduleMarker") < (int)SecurityLevelTypes.ReadWrite)
btnNew.Visible = false;
}
private void LoadCombo()
{
cbScheduleMarkerID.Items.Clear();
FollowUpPickList UList = FollowUpPickList.GetList(new Guid(Request.QueryString["id"].ToString()));
foreach (FollowUpPickList.FollowUpPickListInfo ui in UList)
{
cbScheduleMarkerID.Items.Add( new Telerik.Web.UI.RadComboBoxItem( ui.Name, ui.ID.ToString()));
}
cbScheduleMarkerID.SelectedIndex = 0;
}
protected void btnOK_Click(object sender, ImageClickEventArgs e)
{
Guid smid = Util.ComboValue(cbScheduleMarkerID);
if (smid != Guid.Empty)
{
Util.OpenEditWindow(this, RootObjectTypes.ScheduleMarker, smid);
}
}
protected void btnNew_Click(object sender, ImageClickEventArgs e)
{
ScheduleMarker sm = ScheduleMarker.NewItem();
sm.FollowID = new Guid(Request.QueryString["id"].ToString());
sm.FollowType = (RootObjectTypes)int.Parse(Request.QueryString["type"].ToString());
sm.ScheduleMarkerSourceType = ScheduleMarkerSourceTypes.User;
sm.SourceID = Util.CurrentUserID;
sm.StartDate = DBUtil.CurrentWorkingDateTime;
sm.StopDate = DBUtil.CurrentWorkingDateTime.AddHours(1);
//Put the new unsaved schedulemarker in the cache for a 2 minute window
//so that it's available to the schedulemarker edit form which will immediately remove
//it from the Cache and put it in the session cache
//this is all necessary to support an unsaved schedulemarker so that when user get's to schedulemarkeredit
//they can exit without saving.
Cache.Insert("schedulemarker" + sm.ID.ToString(),
sm,
null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(2));
//Case 760
//Util.OpenEditWindow(this, RootObjectTypes.ScheduleMarker, sm.ID);
string toUrl = "ScheduleMarkerEdit.aspx?id=" + sm.ID.ToString();
Response.Redirect(toUrl, true);
}
//-------------------------------------------------------------------------
}