Exemplo n.º 1
0
        /// <summary>
        /// 添加实验室
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnDepSave_Click(object sender, EventArgs e)
        {
            try
            {
                StringBuilder sb      = new StringBuilder();
                SortedList    SQLlist = new SortedList(new MySort());
                if (DictUserId != 0)
                {
                    if (gdDep.SelectedRowIndexArray.Length != 0)
                    {
                        var library = new DictuserandlabdeptService();
                        Dictuserandlabdept userdep = new Dictuserandlabdept();
                        userdep.Dictuserid = DictUserId;
                        Hashtable hts = new Hashtable();
                        hts.Add("value", userdep.Dictuserid);
                        SQLlist.Add(new Hashtable()
                        {
                            { "DELETE", "Dict.DeleteDictuserandlabdeptByUserId" }
                        }, userdep.Dictuserid);
                        foreach (int row in gdDep.SelectedRowIndexArray)
                        {
                            Dictuserandlabdept dictuserandlabdep = new Dictuserandlabdept();
                            dictuserandlabdep.Dictuserandlabdeptid = library.getSeqID("SEQ_DICTUSERANDLABDEPT");
                            dictuserandlabdep.Dictlabdeptid        = Convert.ToDouble(gdDep.DataKeys[row][0].ToString());
                            dictuserandlabdep.Dictuserid           = Convert.ToInt32(DictUserId);
                            dictuserandlabdep.Createdate           = DateTime.Now;
                            SQLlist.Add(new Hashtable()
                            {
                                { "INSERT", "Dict.InsertDictuserandlabdept" }
                            }, dictuserandlabdep);
                        }

                        if (library.ExecuteSqlTran(SQLlist))
                        {
                            BindGridDep();
                            MessageBoxShow("所选实验室已成功保存,需重新登陆数据才能生效!", MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBoxShow("所选实验室添加有误!", MessageBoxIcon.Warning);
                        }
                    }
                    else
                    {
                        MessageBoxShow("您未选择实验室!", MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    MessageBoxShow("您还未选择用户!", MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBoxShow(ex.Message, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 获取体检单位详细信息
 /// </summary>
 /// <param name="usercode"></param>
 /// <returns></returns>
 public Dictuserandlabdept GetDictuserandlabdeptInfo(Dictuserandlabdept library)
 {
     //Dictuserandlabdept obj = null;
     //IList lst = this.selectIList("Dict.GetDictuserandlabdeptInfo", library);
     //if (lst.Count > 0)
     //    obj = (Dictuserandlabdept)lst[0];
     //return obj;
     return(this.selectObj <Dictuserandlabdept>("Dict.GetDictuserandlabdeptInfo", library));
 }
Exemplo n.º 3
0
        ///<summary>
        ///新增编辑后保存
        ///</summary>
        ///<param name="library"></param>
        /// <returns></returns>
        public bool SaveDictuserandlabdept(Dictuserandlabdept library)
        {
            int nflag = 0;

            //新增
            if (library.Dictuserandlabdeptid == 0 || library.Dictuserandlabdeptid == null)
            {
                try
                {
                    library.Dictuserandlabdeptid = getSeqID("SEQ_DICTUSERANDLABDEPT");
                    insert("Dict.InsertDictuserandlabdept", library);
                    nflag = 1;
                    List <LogInfo> logLst     = getLogInfo <Dictuserandlabdept>(new Dictuserandlabdept(), library);
                    Dictlabdept    dictlabdep = new Dictlabdept();
                    dictlabdep.Dictlabdeptid = library.Dictlabdeptid;
                    dictlabdep = new DictlabdeptService().GetDictlabdeptInfo(dictlabdep);
                    AddMaintenanceLog("Dictuserandlabdept", int.Parse(library.Dictuserandlabdeptid.ToString()), logLst, "新增", dictlabdep.Labdeptname, library.Createdate.ToString(), modulename);
                }
                catch (Exception ex)
                {
                    nflag = 0;
                    throw new Exception(ex.Message);
                }
            }
            else//保存
            {
                try
                {
                    Dictuserandlabdept dictcustomer = GetDictuserandlabdeptInfo(library);
                    nflag = update("Dict.UpdateDictuserandlabdept", library);
                    List <LogInfo> logLst     = getLogInfo <Dictuserandlabdept>(dictcustomer, library);
                    Dictlabdept    dictlabdep = new Dictlabdept();
                    dictlabdep.Dictlabdeptid = library.Dictlabdeptid;
                    dictlabdep = new DictlabdeptService().GetDictlabdeptInfo(dictlabdep);
                    AddMaintenanceLog("Dictuserandlabdept", int.Parse(library.Dictuserandlabdeptid.ToString()), logLst, "修改", dictlabdep.Labdeptname, library.Createdate.ToString(), modulename);
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
            }
            return(nflag > 0);
        }