Esempio n. 1
0
 protected void setCurrentPhase()
 {
     try
     {
         if (Phases != null)
         {
             currentPhase = Phases.FirstOrDefault();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        protected void binddetail()
        {
            string id = string.Empty;
            string order = string.Empty;
            stimulation = CY.CSTS.Core.Business.StimulationCheck.getNew();
            if (stimulation != null)
            {
                IDofCheck.Text = stimulation.Id.ToString();
                stimulationtypelist = CY.CSTS.Core.Business.StimulationType.SelectStimulationTypesByStimulationId(stimulation.Id);
            }

            for (int i = 0; i < stimulationtypelist.Count; i++)
            {
                if (stimulationtypelist.ElementAt(i).StimulatedType == 1)
                {
                    crewtype = stimulationtypelist.ElementAt(i);
                    string sqlwhere = "StimulationAndTypeId = '" + crewtype.Id + "'";
                    applicationCrew = CY.CSTS.Core.Business.StimulationAppliction.GetStimuAppListWhere(sqlwhere, "StimulationApplicationForCrew");
                }
                else if (stimulationtypelist.ElementAt(i).StimulatedType == 2)
                {
                    centertype = stimulationtypelist.ElementAt(i);
                    string sqlwhere = "StimulationAndTypeId = '" + centertype.Id + "'";
                    applicationCenter = CY.CSTS.Core.Business.StimulationAppliction.GetStimuAppListWhere(sqlwhere, "StimulationApplicationForCenter");
                }
                else if (stimulationtypelist.ElementAt(i).StimulatedType == 3 || stimulationtypelist.ElementAt(i).StimulatedType == 4)
                {
                    unitandsubtype = stimulationtypelist.ElementAt(i);
                    string sqlwhere = "StimulationAndTypeId = '" + unitandsubtype.Id + "'";
                    applicationSubAndUnit = CY.CSTS.Core.Business.StimulationAppliction.GetStimuAppListWhere(sqlwhere, "StimulationApplicationForSubCenterAndCollaborateUnit");
                }
            }
            TotalDataCenter = new List<CY.CSTS.Core.Business.StimulationApplicationForCenter>();
            TotalDataCrew = new List<CY.CSTS.Core.Business.StimulationApplicationForCrew>();
            TotalDataSubCenter = new List<CY.CSTS.Core.Business.StimulationApplicationForSubCenterAndCollaborateUnit>();
            TotalDataCoor = new List<CY.CSTS.Core.Business.StimulationApplicationForSubCenterAndCollaborateUnit>();
            if (applicationCenter != null)
            {
                for (int j = 0; j < applicationCenter.Count; j++)
                {
                    CY.CSTS.Core.Business.StimulationApplicationForCenter toolcenter = CY.CSTS.Core.Business.StimulationApplicationForCenter.Load(applicationCenter[j].Id);
                    if (toolcenter != null && toolcenter.State != 1)
                    {
                        TotalDataCenter.Add(toolcenter);
                    }
                }
            }
            if (applicationCrew != null)
            {
                for (int j = 0; j < applicationCrew.Count; j++)
                {
                    CY.CSTS.Core.Business.StimulationApplicationForCrew toolcrew = CY.CSTS.Core.Business.StimulationApplicationForCrew.Load(applicationCrew[j].Id);
                    if (toolcrew != null)
                    {
                        TotalDataCrew.Add(toolcrew);
                    }
                }
            }
            if (applicationSubAndUnit != null)
            {
                for (int j = 0; j < applicationSubAndUnit.Count; j++)
                {
                    CY.CSTS.Core.Business.StimulationApplicationForSubCenterAndCollaborateUnit toolsubcenter = CY.CSTS.Core.Business.StimulationApplicationForSubCenterAndCollaborateUnit.Load(applicationSubAndUnit[j].Id);
                    if (toolsubcenter != null)
                    {
                        CY.CSTS.Core.Business.UnitInfo unit = CY.CSTS.Core.Business.UnitInfo.Load(toolsubcenter.UintId);
                        if (unit != null)
                        {
                            if (unit.IsCooperantUnit == 1)
                            {
                                TotalDataCoor.Add(toolsubcenter);
                            }
                            else
                            {
                                TotalDataSubCenter.Add(toolsubcenter);
                            }
                        }
                    }
                }
            }
            bindapplications();
        }
Esempio n. 3
0
 protected void SetCurrentStimulatio()
 {
     try
     {
         if (stimulations != null)
         {
             currentstimulation = stimulations.FirstOrDefault();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Context.Request.QueryString["tab"] != null && Context.Request.QueryString["tab"] != "")
            {
                hdtype.Value = Context.Request.QueryString["tab"];
            }
            else
            {
                hdtype.Value = "0";
            }
            if (string.IsNullOrEmpty(Context.Request.QueryString["checkid"]) || !CY.Utility.Common.StringHelper.IsGuid(Context.Request.QueryString["checkid"]))
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('参数错误!');</script>");
                return;
            }
            else
            {
                Guid id = new Guid(Context.Request.QueryString["checkid"]);
                checkforcenter = CY.CSTS.Core.Business.StimulationCheck.Load(id);
                if (checkforcenter != null)
                {

                    if (!IsPostBack)
                    {
                        bindPage();
                    }
                }
            }
        }
Esempio n. 5
0
        public string HandlerAddSimulationRequest()
        {
            System.Text.StringBuilder sbResult = new System.Text.StringBuilder();
            System.Text.StringBuilder sbContent = new System.Text.StringBuilder();

            try
            {
                string strName = string.Empty;
                string strContent = string.Empty;
                string strapplydate = string.Empty;
                string strfirstdate = string.Empty;
                string strseconddate = string.Empty;
                string strexaminedate = string.Empty;
                string strenddate = string.Empty;
                string strstatus = string.Empty;
                string strids = string.Empty;

                List<int> ids = null;

                DateTime applyDate = new DateTime();
                DateTime firstDate = new DateTime();
                DateTime secondDate = new DateTime();
                DateTime examineDate = new DateTime();
                DateTime endDate = new DateTime();
                int status = default(int);

                #region Get Params

                if (CY.Utility.Common.RequestUtility.IsGet)
                {
                    strName = CY.Utility.Common.RequestUtility.GetQueryString("name");
                    strContent = CY.Utility.Common.RequestUtility.GetQueryString("content");
                    strapplydate = CY.Utility.Common.RequestUtility.GetQueryString("applydate");
                    strfirstdate = CY.Utility.Common.RequestUtility.GetQueryString("firstdate");
                    strseconddate = CY.Utility.Common.RequestUtility.GetQueryString("seconddate");
                    strexaminedate = CY.Utility.Common.RequestUtility.GetQueryString("examinedate");
                    strenddate = CY.Utility.Common.RequestUtility.GetQueryString("enddate");
                    strstatus = CY.Utility.Common.RequestUtility.GetQueryString("status");
                    strids = CY.Utility.Common.RequestUtility.GetQueryString("ids");

                }
                else if (CY.Utility.Common.RequestUtility.IsPost)
                {
                    strName = CY.Utility.Common.RequestUtility.GetFormString("name");
                    strContent = CY.Utility.Common.RequestUtility.GetFormString("content");
                    strapplydate = CY.Utility.Common.RequestUtility.GetFormString("applydate");
                    strfirstdate = CY.Utility.Common.RequestUtility.GetFormString("firstdate");
                    strseconddate = CY.Utility.Common.RequestUtility.GetFormString("seconddate");
                    strexaminedate = CY.Utility.Common.RequestUtility.GetFormString("examinedate");
                    strenddate = CY.Utility.Common.RequestUtility.GetFormString("enddate");
                    strstatus = CY.Utility.Common.RequestUtility.GetFormString("status");
                    strids = CY.Utility.Common.RequestUtility.GetFormString("ids");
                }

                #endregion

                #region Validation Param

                if (string.IsNullOrEmpty(strName) || string.IsNullOrEmpty(strContent))
                {
                    return sbResult.Append("{success:false,action:'none',status:'none',msg:'参数错误--考评名称和考评内容不能未空!'}").ToString();
                }

                if (!CY.Utility.Common.ParseUtility.TryParseDateTime(strapplydate, out applyDate) || applyDate <= DateTime.MinValue ||
                    !CY.Utility.Common.ParseUtility.TryParseDateTime(strfirstdate, out firstDate) || firstDate <= DateTime.MinValue ||
                    !CY.Utility.Common.ParseUtility.TryParseDateTime(strseconddate, out secondDate) || secondDate <= DateTime.MinValue ||
                    !CY.Utility.Common.ParseUtility.TryParseDateTime(strexaminedate, out examineDate) || examineDate <= DateTime.MinValue ||
                    !CY.Utility.Common.ParseUtility.TryParseDateTime(strenddate, out endDate) || endDate <= DateTime.MinValue
                    )
                {
                    return sbResult.Append("{success:false,action:'none',status:'none',msg:'参数错误--(时间错误)!'}").ToString();
                }

                if (!CY.Utility.Common.ParseUtility.TryParseInt32(strstatus, out status) || status >= 3 && status <= 0)
                {
                    return sbResult.Append("{success:false,action:'none',status:'none',msg:'参数错误--(状态错误)!'}").ToString();
                }

                ids = Newtonsoft.Json.JavaScriptConvert.DeserializeObject(strids, typeof(List<int>)) as List<int>;

                if (CY.CSTS.Core.Business.StimulationCheck.IsExist(strName))
                {
                    return sbResult.Append("{success:false,action:'none',status:'none',msg:'该考评名称已经存在!'}").ToString();
                }

                #endregion

                CY.CSTS.Core.Business.StimulationCheck stimulation = new CY.CSTS.Core.Business.StimulationCheck();
                /*
                 *  初始化 期数数据
                 */

                stimulation.Name = CY.Utility.Common.StringUtility.RemoveIllegalCharacters(strName);
                if (status == 1)
                {
                    stimulation.State = CY.Utility.Common.CodeInterface.PhaseState.GetStart();
                }
                else
                {
                    stimulation.State = CY.Utility.Common.CodeInterface.PhaseState.GetSetUp();
                }
                stimulation.AddData = DateTime.Now;
                stimulation.Content = CY.Utility.Common.StringUtility.RemoveIllegalCharacters(strContent);
                stimulation.EndDate = endDate;
                stimulation.AddPerson = CY.Utility.Common.CodeInterface.UserInterface.UserName;

                stimulation.Save();

                AddStimulationType(stimulation.Id, applyDate, firstDate, secondDate, examineDate, status, ids);

                sbContent.Append("detail:{");
                sbContent.Append(string.Format("id:'{0}'", stimulation.Id));
                sbContent.Append(string.Format(",name:'{0}'", stimulation.Name));
                sbContent.Append(string.Format(",state:'{0}'", CY.Utility.Common.CodeInterface.PhaseState.Start.State));
                sbContent.Append(string.Format(",statename:'{0}'", CY.Utility.Common.CodeInterface.PhaseState.Start.Name));
                sbContent.Append("}");

                sbResult.Append("{success:true,action:'update',statu:'update',msg:'添加成功!'");
                sbResult.Append(",");
                sbResult.Append(sbContent.ToString());
                sbResult.Append("}");
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {

            }
            return sbResult.ToString();
        }