Ejemplo n.º 1
0
        private void btOK_Click(object sender, RoutedEventArgs e)
        {
            if (!Validated())
            {
                return;
            }
            ExamPlace examPlace = new ExamPlace();

            examPlace = GetValue();
            BeOperationInvoker.Invoke <I_CO_IA_Setting, string>(
                channel =>
            {
                string result = channel.SaveExamPlace(examPlace);
                if (string.IsNullOrEmpty(result))
                {
                    MessageBox.Show("保存成功", "提示", MessageBoxButton.OK);
                    if (RefreshExamPlaceEvent != null)
                    {
                        RefreshExamPlaceEvent();
                    }
                    this.Close();
                }
                else
                {
                    MessageBox.Show(result, "提示", MessageBoxButton.OK);
                }
                return("");
            });
        }
Ejemplo n.º 2
0
 public int type    = 0;//标记类型(0:插入;1:更新)
 public ExamSiteDialog(ExamPlace examPlace)
 {
     InitializeComponent();
     ExamPlaceClass = examPlace;
     //CurrentExamPlaceClass = CopyExamPlaceClass();
     this.DataContext = examPlace;
     guid             = examPlace.Guid;
     type             = 0;
 }
Ejemplo n.º 3
0
 /// <summary>
 ///     值改变
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cLookUp_EditValueChanged(object sender, EventArgs e)
 {
     if (ListIsValid == null)
     {
         return;
     }
     CurrenteExamPlace = EditValue == null
            ? null
            : ListIsValid.Find(model => model.ExamPlaceID == Convert.ToInt32(EditValue));
 }
        private static List <ExamPlace> GetExamPlaces(List <DataRow> rows)
        {
            List <ExamPlace> ants = new List <ExamPlace>();

            for (int i = 0; i < rows.Count; i++)
            {
                ExamPlace ant = CreateExamPlace(rows[i]);
                if (ant != null)
                {
                    ants.Add(ant);
                }
            }
            return(ants);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 取得数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        private ExamPlace GetData(int id)
        {
            ExamPlace model = new ExamPlace();

            if (id > 0)
            {
                SystemContext.Instance.ExamPlaceServices.GetExamPlaceByID(id.ToString(), ref model);
            }
            model.ParentID    = Request.Form["ParentID"] != "" ? Request.Form["ParentID"] : "";
            model.ParentName  = Request.Form["ParentName"] != "" ? Request.Form["ParentName"] : "";
            model.PlaceName   = Request.Form["PlaceName"] != "" ? Request.Form["PlaceName"] : "";
            model.Description = Request.Form["Description"] != "" ? Request.Form["Description"] : "";

            return(model);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 取得数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        private ExamPlace GetData(int id)
        {
            ExamPlace model = new  ExamPlace();

            if (id > 0)
            {
                //SystemContext.Instance.EmployeeService.GetEmployeeByID(id.ToString(), ref model);
                model = EnterRepository.GetRepositoryEnter().ExamPlaceRepository.LoadEntities(m => m.ID == id).FirstOrDefault();
            }
            model.ParentID    = Request.Form["ParentID"] != "" ? int.Parse(Request.Form["ParentID"]) : 0;
            model.ParentName  = Request.Form["ParentName"] != "" ? Request.Form["ParentName"] : "";
            model.PlaceName   = Request.Form["PlaceName"] != "" ? Request.Form["PlaceName"] : "";
            model.PlaceType   = Request.Form["PlaceType"] != "" ? Request.Form["PlaceType"] : "";
            model.Description = Request.Form["Description"] != "" ? Request.Form["Description"] : "";

            return(model);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 添加或修改数据
        /// </summary>
        public ActionResult UpdateData()
        {
            try
            {
                int       id    = Request.Form["id"] != "" ? Convert.ToInt32(Request.Form["id"]) : 0;
                ExamPlace model = GetData(id);

                string writeMsg = "操作失败!";
                if (model != null)
                {
                    if (id < 1)
                    {
                        EnterRepository.GetRepositoryEnter().ExamPlaceRepository.AddEntity(model);
                        if (EnterRepository.GetRepositoryEnter().SaveChange() > 0)
                        {
                            writeMsg = "增加成功!";
                        }
                        else
                        {
                            writeMsg = "增加失败!";
                        }
                    }
                    else
                    {
                        //清楚context中result对象
                        EnterRepository.GetRepositoryEnter().ExamPlaceRepository.Get(m => m.ID == id);
                        EnterRepository.GetRepositoryEnter().ExamPlaceRepository.EditEntity(model, new string[] { "ParentID", "PlaceName", "PlaceType", "Description" });
                        if (EnterRepository.GetRepositoryEnter().SaveChange() > 0)
                        {
                            writeMsg = "更新成功!";
                        }
                        else
                        {
                            writeMsg = "更新失败!";
                        }
                    }
                }
                return(Content(writeMsg));
            }
            catch (Exception ex)
            {
                GlobalMethod.log.Error(ex);
                throw;
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 获取指定ID的数据
        /// </summary>
        public ActionResult QueryOneData()
        {
            string     id      = Request.Form["id"] != "" ? Request.Form["id"] : "0";
            ExamPlace  item    = new ExamPlace();
            short      shRet   = SystemContext.Instance.ExamPlaceServices.GetExamPlaceByID(id, ref item);
            JsonHelper json    = new JsonHelper();
            string     strJson = string.Empty;

            if (shRet == ExecuteResult.OK)
            {
                json.AddItem("ID", item.ID.ToString());
                json.AddItem("PlaceName", item.PlaceName);
                json.AddItem("ParentID", item.ParentID);
                json.AddItem("ParentName", item.ParentName);
                json.AddItem("Description", item.Description);
                json.ItemOk();
            }
            strJson = json.ToEasyuiListJsonString();
            return(Content(strJson));
        }
Ejemplo n.º 9
0
        private ExamPlace GetValue()
        {
            ExamPlace temp = new ExamPlace();

            if (guid == "")
            {
                temp.Guid = Utility.NewGuid();
            }
            else
            {
                temp.Guid = guid;
            }
            temp.Name        = this.tbName.Text;
            temp.Address     = this.tbAddress.Text;
            temp.Contact     = this.tbContact.Text;
            temp.Phone       = this.tbPhone.Text;
            temp.Location_la = this.tbLocationLA.Text;
            temp.Location_lg = this.tbLocationLG.Text;
            temp.Remark      = this.tbRemark.Text;

            return(temp);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 添加或修改数据
        /// </summary>
        public ActionResult UpdateData()
        {
            int       id    = Request.Form["id"] != "" ? Convert.ToInt32(Request.Form["id"]) : 0;
            ExamPlace model = GetData(id);

            string writeMsg = "操作失败!";

            if (model != null)
            {
                if (id < 1)
                {
                    short shRet = SystemContext.Instance.ExamPlaceServices.Add(model);
                    if (shRet == ExecuteResult.OK)
                    {
                        writeMsg = "增加成功!";
                    }
                    else
                    {
                        writeMsg = "增加失败!";
                    }
                }
                else
                {
                    short shRet = SystemContext.Instance.ExamPlaceServices.Update(model);
                    if (shRet == ExecuteResult.OK)
                    {
                        writeMsg = "更新成功!";
                    }
                    else
                    {
                        writeMsg = "更新失败!";
                    }
                }
            }
            return(Content(writeMsg));
        }
        private static ExamPlace CreateExamPlace(DataRow dr)
        {
            if (!string.IsNullOrWhiteSpace(dr["考点名称"].ToString()))
            {
                ExamPlace examPlace = new ExamPlace();
                examPlace.Guid = Guid.NewGuid().ToString();
                examPlace.Name = dr["考点名称"].ToString();

                if (!string.IsNullOrEmpty(dr["考点地址"].ToString()))
                {
                    examPlace.Address = dr["考点地址"].ToString();
                }
                else
                {
                    examPlace.Address = null;
                }
                if (!string.IsNullOrEmpty(dr["联系人"].ToString()))
                {
                    examPlace.Contact = dr["联系人"].ToString();
                }
                else
                {
                    examPlace.Contact = null;
                }
                if (!string.IsNullOrEmpty(dr["联系电话"].ToString()))
                {
                    examPlace.Phone = dr["联系电话"].ToString();
                }
                else
                {
                    examPlace.Phone = null;
                }
                if (!string.IsNullOrEmpty(dr["经度"].ToString()))
                {
                    examPlace.Location_lg = dr["经度"].ToString();
                }
                else
                {
                    examPlace.Location_lg = null;
                }
                if (!string.IsNullOrEmpty(dr["纬度"].ToString()))
                {
                    examPlace.Location_la = dr["纬度"].ToString();
                }
                else
                {
                    examPlace.Location_la = null;
                }
                if (!string.IsNullOrEmpty(dr["所属地区编码"].ToString()))
                {
                    examPlace.Areacode = dr["所属地区编码"].ToString();
                }
                else
                {
                    examPlace.Location_la = null;
                }
                if (!string.IsNullOrEmpty(dr["备注"].ToString()))
                {
                    examPlace.Remark = dr["备注"].ToString();
                }
                else
                {
                    examPlace.Remark = null;
                }
                if (!string.IsNullOrEmpty(dr["图片名称"].ToString()))
                {
                    string[] imgPaths = dr["图片名称"].ToString().Split('|');
                    for (int i = 0; i < imgPaths.Length; i++)
                    {
                        ActivityPlaceLocationImage activityPlaceLocationImage = new ActivityPlaceLocationImage();
                        string path      = ImageFilePath + "\\" + imgPaths[i];
                        byte[] imageData = File.ReadAllBytes(path);
                        byte[] imageOut  = AT_BC.Common.ImageZipper.ZipAsJpg(imageData, 800, 600);
                        activityPlaceLocationImage.GUID = Guid.NewGuid().ToString();
                        activityPlaceLocationImage.ACTIVITY_PLACE_LOCATION_GUID = examPlace.Guid;
                        activityPlaceLocationImage.Image = imageOut;
                        activityPlaceLocationImage.TYPE  = Convert.ToInt32(dr["图片类型"].ToString().Split('|')[i]);

                        examPlace.Images.Add(activityPlaceLocationImage);
                    }
                }

                return(examPlace);
            }
            else
            {
                return(null);
            }
        }