예제 #1
0
        protected void btnOk_Click(object sender, EventArgs e)
        {
            string str = ViewState["PostID"].ToString();

            foreach (TreeViewNode node in tvTrainType.Nodes)
            {
                if (node.Checked == true)
                {
                    TrainStandardBLL objTrainStandard = new TrainStandardBLL();
                    IList <RailExam.Model.TrainStandard> objTrainStandardList =
                        objTrainStandard.GetTrainStandardInfo(0, Convert.ToInt32(str), Convert.ToInt32(node.Value), "", "", "", "", "", "", 0, 200, "");

                    if (objTrainStandardList.Count == 0)
                    {
                        RailExam.Model.TrainStandard obj = new RailExam.Model.TrainStandard();

                        obj.PostID       = Convert.ToInt32(str);
                        obj.TypeID       = Convert.ToInt32(node.Value);
                        obj.TrainTime    = "";
                        obj.TrainContent = "";
                        obj.TrainForm    = "";
                        obj.ExamForm     = "";
                        obj.Description  = "";
                        obj.Memo         = "";

                        objTrainStandard.AddTrainStandard(obj);
                    }
                }

                if (node.Nodes.Count > 0)
                {
                    foreach (TreeViewNode childnode in node.Nodes)
                    {
                        if (childnode.Checked == true)
                        {
                            TrainStandardBLL objTrainStandard = new TrainStandardBLL();
                            IList <RailExam.Model.TrainStandard> objTrainStandardList =
                                objTrainStandard.GetTrainStandardInfo(0, Convert.ToInt32(str), Convert.ToInt32(childnode.Value), "", "", "", "", "", "", 0, 200, "");

                            if (objTrainStandardList.Count == 0)
                            {
                                RailExam.Model.TrainStandard obj = new RailExam.Model.TrainStandard();

                                obj.PostID       = Convert.ToInt32(str);
                                obj.TypeID       = Convert.ToInt32(childnode.Value);
                                obj.TrainTime    = "";
                                obj.TrainContent = "";
                                obj.TrainForm    = "";
                                obj.ExamForm     = "";
                                obj.Description  = "";
                                obj.Memo         = "";

                                objTrainStandard.AddTrainStandard(obj);
                            }
                        }
                    }
                }
            }
            Response.Write("<script>window.opener.form1.Refresh.value='" + str + "' ;window.opener.form1.submit();window.close();</script>");
        }
        private void AddImplateType(ArrayList objList)
        {
            tvTrainType.Nodes.Clear();
            TrainTypeBLL trainTypeBLL = new TrainTypeBLL();

            IList <TrainType> trainTypeList = trainTypeBLL.GetTrainTypeInfo(0, 0, 0, "", 0, "", "", true, false, "", 0, 200, "LevelNum,OrderIndex ASC");

            if (trainTypeList.Count > 0)
            {
                foreach (TrainType trainType in trainTypeList)
                {
                    if (objList.Count > 0)
                    {
                        if (objList.IndexOf(trainType.TrainTypeID) != -1)
                        {
                            continue;
                        }
                    }

                    TrainStandardBLL             trainStandardBLL = new TrainStandardBLL();
                    RailExam.Model.TrainStandard trainStandard    = new RailExam.Model.TrainStandard();

                    trainStandard.PostID       = Convert.ToInt32(ViewState["PostID"].ToString());
                    trainStandard.TypeID       = Convert.ToInt32(trainType.TrainTypeID);
                    trainStandard.TrainTime    = "";
                    trainStandard.TrainContent = "";
                    trainStandard.TrainForm    = "";
                    trainStandard.ExamForm     = "";
                    trainStandard.Description  = "";
                    trainStandard.Memo         = "";

                    trainStandardBLL.AddTrainStandard(trainStandard);
                }
            }

            BindtvType(ViewState["PostID"].ToString());
        }