protected void SaveStimulition(CY.CSTS.Core.Business.StimulationCheck stimulition, int statetype)
        {
            IList<CY.CSTS.Core.Business.StimulationType> stimulationlist = new List<CY.CSTS.Core.Business.StimulationType>();
            StringBuilder res = new StringBuilder();

            for (int i = 0; i < this.CheckBoxContent.Items.Count; i++)
            {
                if (CheckBoxContent.Items[i].Selected)
                {
                    res.Append(CheckBoxContent.Items[i].Value + ",");
                    if (CheckBoxContent.Items[i].Value == "分中心与协作单位")
                    {
                        CY.CSTS.Core.Business.StimulationType unit = new CY.CSTS.Core.Business.StimulationType();
                        unit.DateCreated = DateTime.Now;
                        unit.Des = TxtUnit1.Text;
                        unit.StimulatedType = 3;
                        unit.State = statetype;
                        stimulationlist.Add(unit);

                    }
                    if (CheckBoxContent.Items[i].Value == "中心")
                    {
                        CY.CSTS.Core.Business.StimulationType center = new CY.CSTS.Core.Business.StimulationType();
                        center.DateCreated = DateTime.Now;
                        center.Des = TxtCenter1.Text;
                        center.StimulatedType = 2;
                        center.State = statetype;
                        stimulationlist.Add(center);

                    }
                    if (CheckBoxContent.Items[i].Value == "机组")
                    {
                        CY.CSTS.Core.Business.StimulationType crew = new CY.CSTS.Core.Business.StimulationType();
                        crew.DateCreated = DateTime.Now;
                        crew.Des = TxtCrew1.Text;
                        crew.StimulatedType = 1;
                        crew.State = statetype;
                        stimulationlist.Add(crew);
                    }

                }

            }
            if (res.Length > 1)
            {
                res.Remove(res.Length - 1, 1);
            }
            stimulition.Content = res.ToString();
            stimulition.Name = Txtname.Text;
            stimulition.StartDate = Convert.ToDateTime(TxtUnload.Text);
            stimulition.EndDate = Convert.ToDateTime(TxtJudge.Text);
            stimulition.AddData = DateTime.Now;
            //stimulition.AddPerson = Session[User];
            //stimulition.DateCreated=Convert.ToDateTime(TxtFirst.Text);
            stimulition.Save();
            for (int i = 0; i < stimulationlist.Count; i++)
            {
                stimulationlist.ElementAt(i).StimulationId = stimulition.Id;
                stimulationlist.ElementAt(i).Save();
            }
            bindDatas();
        }
        protected void Updatestimulition(CY.CSTS.Core.Business.StimulationCheck stimulition, int statetype)
        {
            IList<CY.CSTS.Core.Business.StimulationType> stimulationlist = CY.CSTS.Core.Business.StimulationType.SelectStimulationTypesByStimulationId(stimulition.Id);
            IList<CY.CSTS.Core.Business.StimulationType> addlist = new List<CY.CSTS.Core.Business.StimulationType>();
            StringBuilder res = new StringBuilder();

            for (int i = 0; i < this.CheckBoxContent.Items.Count; i++)
            {
                if (CheckBoxContent.Items[i].Selected)
                {
                    res.Append(CheckBoxContent.Items[i].Value + ",");
                    if (CheckBoxContent.Items[i].Value == "分中心与协作单位")
                    {
                        bool isexit = false;
                        for (int j = 0; j < stimulationlist.Count; j++)
                        {
                            if (stimulationlist.ElementAt(j).StimulatedType == 3)
                            {
                                isexit = true;
                                CY.CSTS.Core.Business.StimulationType unit = stimulationlist.ElementAt(j);
                                unit.DateCreated = DateTime.Now;
                                unit.Des = TxtUnit1.Text;
                                unit.StimulatedType = 3;
                                unit.State = statetype;
                                unit.Save();
                            }
                        }
                        if (!isexit)
                        {
                            CY.CSTS.Core.Business.StimulationType unit = new CY.CSTS.Core.Business.StimulationType();
                            unit.DateCreated = DateTime.Now;
                            unit.Des = TxtUnit1.Text;
                            unit.StimulatedType = 3;
                            unit.State = statetype;
                            addlist.Add(unit);

                        }

                    }
                    if (CheckBoxContent.Items[i].Value == "中心")
                    {
                        bool isexit = false;
                        for (int j = 0; j < stimulationlist.Count; j++)
                        {
                            if (stimulationlist.ElementAt(j).StimulatedType == 2)
                            {
                                isexit = true;
                                CY.CSTS.Core.Business.StimulationType center = stimulationlist.ElementAt(j);
                                center.DateCreated = DateTime.Now;
                                center.Des = TxtCenter1.Text;
                                center.StimulatedType = 2;
                                center.State = statetype;
                                center.Save();
                            }

                        }
                        if (!isexit)
                        {
                            CY.CSTS.Core.Business.StimulationType center = new CY.CSTS.Core.Business.StimulationType();
                            center.DateCreated = DateTime.Now;
                            center.Des = TxtCenter1.Text;
                            center.StimulatedType = 2;
                            center.State = statetype;
                            addlist.Add(center);
                        }
                    }
                    if (CheckBoxContent.Items[i].Value == "机组")
                    {
                        bool isexit = false;
                        for (int j = 0; j < stimulationlist.Count; j++)
                        {
                            if (stimulationlist.ElementAt(j).StimulatedType == 1)
                            {
                                isexit = true;
                                CY.CSTS.Core.Business.StimulationType crew = stimulationlist.ElementAt(j);
                                crew.DateCreated = DateTime.Now;
                                crew.Des = TxtCrew1.Text;
                                crew.StimulatedType = 1;
                                crew.State = statetype;
                                crew.Save();
                            }

                        }
                        if (!isexit)
                        {
                            CY.CSTS.Core.Business.StimulationType crew = new CY.CSTS.Core.Business.StimulationType();
                            crew.DateCreated = DateTime.Now;
                            crew.Des = TxtCrew1.Text;
                            crew.StimulatedType = 1;
                            crew.State = statetype;
                            addlist.Add(crew);
                        }

                    }

                }

            }
            if (res.Length > 1)
            {
                res.Remove(res.Length - 1, 1);
            }
            stimulition.Content = res.ToString();
            stimulition.Name = Txtname.Text;
            stimulition.StartDate = Convert.ToDateTime(TxtUnload.Text);
            stimulition.EndDate = Convert.ToDateTime(TxtJudge.Text);
            stimulition.AddData = DateTime.Now;
            stimulition.Save();
            for (int i = 0; i < addlist.Count; i++)
            {
                addlist.ElementAt(i).StimulationId = stimulition.Id;
                addlist.ElementAt(i).Save();
            }
            bindDatas();
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Context.Request.QueryString["appId"]) || !CY.Utility.Common.StringUtility.IsGuid(Request.QueryString["appId"]))
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('参数错误!');</script>");
                return;
            }

            CY.CSTS.Core.Business.StimulationCheck stimulation = CY.CSTS.Core.Business.StimulationCheck.getNew();
            if (stimulation != null)
            {
                stimulationtypelist = CY.CSTS.Core.Business.StimulationType.SelectStimulationTypesByStimulationId(stimulation.Id);
            }
            for (int i = 0; i < stimulationtypelist.Count; i++)
            {
                if (stimulationtypelist.ElementAt(i).StimulatedType == 3 || stimulationtypelist.ElementAt(i).StimulatedType == 4)
                {
                    unitandsubtype = stimulationtypelist.ElementAt(i);
                }
            }
            positiontype = Context.Request.QueryString["type"];
            positionstate = Context.Request.QueryString["state"];
            id = new Guid(Context.Request.QueryString["appId"]);
            hdAppId.Value = id.ToString();
            stiforsub_coop = StimulationApplicationForSubCenterAndCollaborateUnit.Load(id);
            if (stiforsub_coop != null)
            {
                lbAppPerson.Text = stiforsub_coop.DraftWriter;
                CY.CSTS.Core.Business.UnitInfo uinfo = CY.CSTS.Core.Business.UnitInfo.Load(stiforsub_coop.UintId);
                if (uinfo != null)
                {
                    lbUnitName.Text = uinfo.UnitName;
                    lbTel.Text = uinfo.LinkmanTel;
                    if (uinfo.IsCooperantUnit == 1)
                    {
                        unitStr = "coor";
                    }
                    else
                    {
                        unitStr = "sub";
                    }
                    hdUnitType.Value = unitStr;
                }
                JudgeUnit();
                if (!IsPostBack)
                {

                    bindCtr();
                    BindPage();
                }

            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('参数错误!');</script>");
                return;
            }

            //获取附件
            attachmentList = CY.CSTS.Core.Business.Annex.SelectAnnexByContentID(id);
        }