Ejemplo n.º 1
0
        protected void rowOper(object source, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Sel")
            {
                lbAlertInfo.Text = "";
                object obj = e.CommandArgument;
                System.Guid expid = System.Guid.Empty;
                if (obj != null && CY.Utility.Common.StringUtility.IsGuid(obj.ToString()) && (expid = new Guid(obj.ToString())) != System.Guid.Empty)
                {
                    if (Hdid.Value != "" && new Guid(Hdid.Value) != default(Guid))
                    {
                        IList<CY.CSTS.Core.Business.StimulationApplicationForSubCenterAndCollaborateUnit> UnitList = CY.CSTS.Core.Business.StimulationApplicationForSubCenterAndCollaborateUnit.GetStimulationApplicationBySql("UintId='" + new Guid(Hdid.Value) + "'", "");
                        CY.CSTS.Core.Business.StimulationApplicationForSubCenterAndCollaborateUnit Unit = null;
                        if (UnitList != null && UnitList.Count != 0)
                        {
                            for (int i = 0; i < UnitList.Count; i++)
                            {
                                if (UnitList[i].State == 8)
                                {
                                    Unit = UnitList[i];
                                    break;
                                }
                            }

                        }

                        if (Unit != null)
                        {
                            string sqlwhwew = "[StimulationAppID]='" + Unit.Id + "' and [ExpertID]='" + expid + "'";
                            IList<CY.CSTS.Core.Business.StimulationExpertAssignment> jrlist = CY.CSTS.Core.Business.StimulationExpertAssignment.SelectStimulationExpertAssignmentDynamic(sqlwhwew, "");
                            if (jrlist == null || jrlist.Count == 0)
                            {
                                CY.CSTS.Core.Business.StimulationExpertAssignment jre = new CY.CSTS.Core.Business.StimulationExpertAssignment();
                                jre.StimulationAppID = Unit.Id;
                                jre.ExpertID = expid;
                                jre.Save();
                                lbAlertInfo.Text = "添加成功";
                                bindgvSelList(new Guid(Hdid.Value));
                            }
                            else
                            {
                                lbAlertInfo.Text = "请勿重复添加";
                            }
                        }
                    }
                    else if (hdCrewList.Value != null && hdCrewList.Value != "")
                    {
                        string crewlisttemp = hdCrewList.Value.Substring(0, hdCrewList.Value.LastIndexOf(','));
                        List<String> crewList = crewlisttemp.Split(',').ToList();
                        for (int i = 0; i < crewList.Count; i++)
                        {
                            try
                            {
                                Guid crewId = new Guid(crewList[i]);
                                CY.CSTS.Core.Business.StimulationExpertAssignment crewAss = new CY.CSTS.Core.Business.StimulationExpertAssignment();
                                crewAss.StimulationAppID = crewId;
                                crewAss.ExpertID = expid;
                                crewAss.Save();

                            }
                            catch (Exception ex)
                            { }
                        }
                        lbAlertInfo.Text = "添加成功";

                        IList<CY.CSTS.Core.Business.User> uList = new List<CY.CSTS.Core.Business.User>();
                        IList<CY.CSTS.Core.Business.StimulationExpertAssignment> explisttemp = CY.CSTS.Core.Business.StimulationExpertAssignment.SelectStimulationExpertAssignmentDynamic("StimulationAppID='" + crewList[0] + "'", "");
                        if (explisttemp != null)
                        {
                            for (int j = 0; j < explisttemp.Count; j++)
                            {
                                CY.CSTS.Core.Business.User u = CY.CSTS.Core.Business.User.Load(explisttemp[j].ExpertID);
                                if (u != null)
                                {
                                    uList.Add(u);
                                }
                            }

                        }

                        gvSelList.DataSource = uList;
                        gvSelList.DataBind();

                        bindUnitList();

                    }
                }
                else
                {
                    lbAlertInfo.Text = "参数错误";
                }
            }
        }
Ejemplo n.º 2
0
        protected void rowOper(object source, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Sel")
            {
                lbSelAlert.InnerText = "";
                object obj = e.CommandArgument;
                System.Guid expid = System.Guid.Empty;
                if (obj != null && CY.Utility.Common.StringUtility.IsGuid(obj.ToString()) && (expid = new Guid(obj.ToString())) != System.Guid.Empty)
                {
                    string sqlwhwew = "[StimulationAppID]='" + Hdid.Value + "' and [ExpertID]='" + expid + "'";
                    IList<CY.CSTS.Core.Business.StimulationExpertAssignment> jrlist = CY.CSTS.Core.Business.StimulationExpertAssignment.SelectStimulationExpertAssignmentDynamic(sqlwhwew, "");
                    if (jrlist == null || jrlist.Count == 0)
                    {
                        CY.CSTS.Core.Business.StimulationExpertAssignment jre = new CY.CSTS.Core.Business.StimulationExpertAssignment();
                        jre.StimulationAppID = new Guid(Hdid.Value);
                        jre.ExpertID = expid;
                        jre.Save();
                        lbexpAlert.InnerText = "添加成功";
                        bindgvSelList();

                        CY.CSTS.Core.Business.StimulationApplicationForCenter appforCen = CY.CSTS.Core.Business.StimulationApplicationForCenter.Load(idForEcterExpert);
                        if (appforCen != null)
                        {
                            appforCen.State = 7;
                            appforCen.Save();
                        }
                    }
                    else
                    {
                        lbexpAlert.InnerText = "请勿重复添加";
                    }
                }
                else
                {
                    lbexpAlert.InnerText = "参数错误";
                }
            }
        }