Example #1
0
        void dgLicense_CurrentCellChanged(object sender, EventArgs e)
        {
            DataGrid grid = sender as DataGrid;

            if (grid.SelectedItem != null)
            {
                Licensemaster = (T_OA_LICENSEMASTER)grid.SelectedItems[0];//获取当前选中的行数据并转换为对应的实体
            }
        }
Example #2
0
 void dgLicense_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     DataGrid grid = sender as DataGrid;
     if (grid.SelectedItems.Count == 0)
         return;
     if (grid.SelectedItems.Count  > 0 )
     {
         Licensemaster = (T_OA_LICENSEMASTER)grid.SelectedItems[0];//获取当前选中的行数据并转换为对应的实体     
     }
 }
Example #3
0
        public string UpdateLicenseDetail(T_OA_LICENSEDETAIL[] licenseDetailObj, T_OA_LICENSEMASTER licenseMasterObj)
        {
            string returnStr = "";

            using (LicenseDetailManagementBll licenseDetailBll = new LicenseDetailManagementBll())
            {
                if (!licenseDetailBll.UpdateLicenseDetail(licenseDetailObj, licenseMasterObj))
                {
                    returnStr = "更新数据失败";
                }
                return(returnStr);
            }
        }
Example #4
0
        void dgLicense_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DataGrid grid = sender as DataGrid;

            if (grid.SelectedItems.Count == 0)
            {
                return;
            }
            if (grid.SelectedItems.Count > 0)
            {
                Licensemaster = (T_OA_LICENSEMASTER)grid.SelectedItems[0];//获取当前选中的行数据并转换为对应的实体
            }
        }
Example #5
0
        private void AddLicenseMatserObjList()
        {
            if (licenseMatserObjList != null)
            {
                licenseMatserObjList.Clear();
                if (dicts != null && dicts.Count > 0)
                {
                    foreach (var h in dicts)
                    {
                        T_OA_LICENSEMASTER licenseMaster = new T_OA_LICENSEMASTER();
                        //licenseMaster.ORGCODE = organ.ORGCODE;

                        licenseMaster.LICENSEMASTERID   = Guid.NewGuid().ToString();
                        licenseMaster.LICENSENAME       = h.DICTIONARYNAME;
                        licenseMaster.POSITION          = " ";
                        licenseMaster.LEGALPERSON       = organ.LEGALPERSON;
                        licenseMaster.ADDRESS           = organ.ADDRESS;
                        licenseMaster.LICENCENO         = organ.LICENCENO;
                        licenseMaster.BUSSINESSAREA     = organ.BUSSINESSAREA;
                        licenseMaster.DAY               = 0;
                        licenseMaster.LENDFLAG          = "0";
                        licenseMaster.ISVALID           = "0";
                        licenseMaster.T_OA_ORGANIZATION = organ;

                        licenseMaster.OWNERID            = Common.CurrentLoginUserInfo.EmployeeID;
                        licenseMaster.OWNERNAME          = Common.CurrentLoginUserInfo.EmployeeName;
                        licenseMaster.OWNERCOMPANYID     = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
                        licenseMaster.OWNERDEPARTMENTID  = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
                        licenseMaster.OWNERPOSTID        = Common.CurrentLoginUserInfo.UserPosts[0].PostID;
                        licenseMaster.CREATEUSERID       = Common.CurrentLoginUserInfo.EmployeeID;
                        licenseMaster.CREATEUSERNAME     = Common.CurrentLoginUserInfo.EmployeeName;
                        licenseMaster.CREATECOMPANYID    = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
                        licenseMaster.CREATEDEPARTMENTID = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
                        licenseMaster.CREATEPOSTID       = Common.CurrentLoginUserInfo.UserPosts[0].PostID;

                        licenseMaster.CREATEDATE = DateTime.Now;

                        licenseMatserObjList.Add(licenseMaster);
                    }
                }
            }
        }
Example #6
0
        private void ChooseLicense()
        {
            Dictionary <string, string> cols = new Dictionary <string, string>();

            cols.Add("LICENSENAME", "LICENSENAME");
            cols.Add("LEGALPERSON", "LEGALPERSON");
            cols.Add("LICENCENO", "LICENCENO");
            cols.Add("DAY", "DAY");
            LookupForm lookup = new LookupForm(SMT.SaaS.OA.UI.SmtOADocumentAdminService.EntityNames.LicenseBorrow,
                                               typeof(T_OA_LICENSEMASTER[]), cols);

            lookup.SelectedClick += (o, ev) =>
            {
                T_OA_LICENSEMASTER ent = lookup.SelectedObj as T_OA_LICENSEMASTER;
                if (ent != null)
                {
                    LicenseObj.T_OA_LICENSEMASTER = ent;
                    this.txtLicenseName.Text      = ent.LICENSENAME;
                }
            };
            lookup.Show();
        }
Example #7
0
        /// <summary>
        /// 新增机构
        /// </summary>
        /// <param name="organObj"></param>
        /// <returns></returns>
        public bool AddOrgan(T_OA_ORGANIZATION organObj, List <T_OA_LICENSEMASTER> licenseMasterList)
        {
            try
            {
                //int i = dal.Add(organObj);
                //OrganContext.AddObject("T_OA_ORGANIZATION", organObj);
                //int i = OrganContext.SaveChanges();
                int i = dal.Add(organObj);
                if (licenseMasterList.Count() < 1)
                {
                    return(i > 0 ? true : false);
                }
                foreach (var h in licenseMasterList)
                {
                    T_OA_LICENSEMASTER ent = new T_OA_LICENSEMASTER();
                    CloneEntity(h, ent);

                    ent.T_OA_ORGANIZATION = null;
                    ent.T_OA_ORGANIZATIONReference.EntityKey = new System.Data.EntityKey("TM_SaaS_OA_EFModelContext.T_OA_ORGANIZATION", "ORGCODE", h.T_OA_ORGANIZATION.ORGCODE);
                    //h.T_OA_ORGANIZATION = OrganContext.GetObjectByKey(h.T_OA_ORGANIZATION.EntityKey) as T_OA_ORGANIZATION;
                    //OrganContext.AddObject("T_OA_LICENSEMASTER", ent);
                    //LicenseManagementBll.Add(ent);
                    //int i = base.Add(ent);
                    int k = dal.Add(ent);
                    if (!(k > 0))
                    {
                        return(false);
                    }
                }


                return(true);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Example #8
0
        public bool UpdateLicenseDetail(T_OA_LICENSEDETAIL[] licenseDetailObj, T_OA_LICENSEMASTER licenseMasterObj)
        {
            dal.BeginTransaction();
            try
            {
                bool flag = true;
                //添加或更新子表信息
                if (licenseMasterObj == null || licenseDetailObj == null)
                {
                    return(false);
                }
                foreach (var license in licenseDetailObj)
                {
                    license.T_OA_LICENSEMASTER = dal.GetObjectByEntityKey(license.T_OA_LICENSEMASTER.EntityKey) as T_OA_LICENSEMASTER;
                    //context.AddObject("T_OA_CONSERVATION", requireResultInfo);
                    //context.AddObject("T_OA_LICENSEDETAIL", license);
                    int a = dal.Add(license);
                    if (!(a > 0))
                    {
                        return(false);
                    }
                }

                if (flag)
                {
                    if (licenseDetailObj.Count() > 0)   //子表有更新时根据子表更新主表
                    {
                        T_OA_LICENSEDETAIL licenseLastDetailObj = GetLastUpdateObj(licenseDetailObj);

                        //var entitys = licenseDal.GetTable().FirstOrDefault(s => s.LICENSEMASTERID == licenseLastDetailObj.LICENSEMASTERID);
                        var entitys = dal.GetObjects <T_OA_LICENSEMASTER>().FirstOrDefault(s => s.LICENSEMASTERID == licenseLastDetailObj.T_OA_LICENSEMASTER.LICENSEMASTERID);

                        if (entitys != null)
                        {
                            //更新主表
                            entitys.LEGALPERSON    = licenseLastDetailObj.LEGALPERSON;
                            entitys.ADDRESS        = licenseLastDetailObj.ADDRESS;
                            entitys.LICENCENO      = licenseLastDetailObj.LICENCENO;
                            entitys.BUSSINESSAREA  = licenseLastDetailObj.BUSSINESSAREA;
                            entitys.FROMDATE       = licenseLastDetailObj.FROMDATE;
                            entitys.TODATE         = licenseLastDetailObj.TODATE;
                            entitys.DAY            = licenseMasterObj.DAY;
                            entitys.POSITION       = licenseMasterObj.POSITION;
                            entitys.UPDATEDATE     = licenseLastDetailObj.UPDATEDATE;
                            entitys.UPDATEUSERID   = licenseLastDetailObj.UPDATEUSERID;
                            entitys.UPDATEUSERNAME = licenseLastDetailObj.UPDATEUSERNAME;
                            int n = dal.Update(entitys);
                            if (!(n > 0))
                            {
                                return(false);
                            }
                        }
                    }
                    else                              //子表没有更新时直接更新主表
                    {
                        var entitys = dal.GetObjects <T_OA_LICENSEMASTER>().FirstOrDefault(s => s.LICENSEMASTERID == licenseMasterObj.LICENSEMASTERID);
                        if (entitys != null)
                        {
                            entitys.DAY            = licenseMasterObj.DAY;
                            entitys.POSITION       = licenseMasterObj.POSITION;
                            entitys.UPDATEDATE     = licenseMasterObj.UPDATEDATE;
                            entitys.UPDATEUSERID   = licenseMasterObj.UPDATEUSERID;
                            entitys.UPDATEUSERNAME = licenseMasterObj.UPDATEUSERNAME;
                            int k = dal.Update(entitys);
                            if (!(k > 0))
                            {
                                return(false);
                            }
                        }
                    }
                    //dal.CommitTransaction();

                    return(true);
                }
            }
            catch (Exception ex)
            {
                //dal.RollbackTransaction();
                throw (ex);
                //return false;
            }
            return(false);
        }
Example #9
0
        /// <summary>
        /// 根据传回的XML,添加证照印章表
        /// </summary>
        /// <param name="xele"></param>
        private static string LicensemasterAdd(IEnumerable<XElement> eGFunc)
        {
            try
            {
                if (eGFunc.Count() == 0)
                {
                    return "";
                }
                string strEmployeeID = string.Empty;
                string strOwnerID = string.Empty;
                string strOwnerPostID = string.Empty;
                string strOwnerDepartmentID = string.Empty;
                string strOwnerCompanyID = string.Empty;

                foreach (var q in eGFunc)
                {
                    string strName = q.Attribute("Name").Value;
                    switch (strName)
                    {
                        case "CREATEUSERID":
                            strEmployeeID = q.Attribute("Value").Value;
                            break;
                        case "OWNERID":
                            strOwnerID = q.Attribute("Value").Value;
                            break;
                        case "OWNERPOSTID":
                            strOwnerPostID = q.Attribute("Value").Value;
                            break;
                        case "OWNERDEPARTMENTID":
                            strOwnerDepartmentID = q.Attribute("Value").Value;
                            break;
                        case "OWNERCOMPANYID":
                            strOwnerCompanyID = q.Attribute("Value").Value;
                            break;
                    }
                }

                string employeeid = strEmployeeID.Replace("{", "").Replace("}", "");

                List<T_OA_LICENSEMASTER> lm = new List<T_OA_LICENSEMASTER>();
                T_OA_LICENSEMASTER entity = new T_OA_LICENSEMASTER();

                entity.LICENSEMASTERID = Guid.NewGuid().ToString();
                entity.CREATEDATE = DateTime.Now;
                entity.OWNERID = strOwnerID;
                entity.OWNERPOSTID = strOwnerPostID;
                entity.OWNERDEPARTMENTID = strOwnerDepartmentID;
                entity.OWNERCOMPANYID = strOwnerCompanyID;
                entity.CREATEUSERID = strOwnerID;
                entity.CREATEPOSTID = strOwnerPostID;
                entity.CREATEDEPARTMENTID = strOwnerDepartmentID;
                entity.CREATECOMPANYID = strOwnerCompanyID;
                lm.Add(entity);

                OrganManagementBll organBll = new OrganManagementBll();
                if (organBll.AddOrgan(null, lm))
                {
                    return entity.LICENSEMASTERID;
                }
                else
                {
                    string err = "Error";
                    return err;
                }
            }
            catch (Exception e)
            {
                string abc = "<OA>Message=[" + e.Message + "]" + "<OA>Source=[" + e.Source + "]<OA>StackTrace=[" + e.StackTrace + "]<OA>TargetSite=[" + e.TargetSite + "]";
                Tracer.Debug(abc);
                return abc;
            }
        }
Example #10
0
 public string UpdateLicenseDetail(T_OA_LICENSEDETAIL[] licenseDetailObj,T_OA_LICENSEMASTER licenseMasterObj)
 {
     string returnStr = "";
     using (LicenseDetailManagementBll licenseDetailBll = new LicenseDetailManagementBll())
     {
         if (!licenseDetailBll.UpdateLicenseDetail(licenseDetailObj, licenseMasterObj))
         {
             returnStr = "更新数据失败";
         }
         return returnStr;
     }
 }
Example #11
0
 void dgLicense_CurrentCellChanged(object sender, EventArgs e)
 {
     DataGrid grid = sender as DataGrid;
     if (grid.SelectedItem != null)
     {
         Licensemaster = (T_OA_LICENSEMASTER)grid.SelectedItems[0];//获取当前选中的行数据并转换为对应的实体     
     }
 }
Example #12
0
        private void AddLicenseMatserObjList()
        {
            if (licenseMatserObjList != null)
            {
                licenseMatserObjList.Clear();
                if (dicts != null && dicts.Count > 0)
                {
                    foreach (var h in dicts)
                    {
                        T_OA_LICENSEMASTER licenseMaster = new T_OA_LICENSEMASTER();
                        //licenseMaster.ORGCODE = organ.ORGCODE;
                        
                        licenseMaster.LICENSEMASTERID = Guid.NewGuid().ToString();
                        licenseMaster.LICENSENAME = h.DICTIONARYNAME;
                        licenseMaster.POSITION = " ";
                        licenseMaster.LEGALPERSON = organ.LEGALPERSON;
                        licenseMaster.ADDRESS = organ.ADDRESS;
                        licenseMaster.LICENCENO = organ.LICENCENO;
                        licenseMaster.BUSSINESSAREA = organ.BUSSINESSAREA;
                        licenseMaster.DAY = 0;
                        licenseMaster.LENDFLAG = "0";
                        licenseMaster.ISVALID = "0";
                        licenseMaster.T_OA_ORGANIZATION = organ;

                        licenseMaster.OWNERID = Common.CurrentLoginUserInfo.EmployeeID;
                        licenseMaster.OWNERNAME = Common.CurrentLoginUserInfo.EmployeeName;
                        licenseMaster.OWNERCOMPANYID = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
                        licenseMaster.OWNERDEPARTMENTID = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
                        licenseMaster.OWNERPOSTID = Common.CurrentLoginUserInfo.UserPosts[0].PostID;
                        licenseMaster.CREATEUSERID = Common.CurrentLoginUserInfo.EmployeeID;
                        licenseMaster.CREATEUSERNAME = Common.CurrentLoginUserInfo.EmployeeName;
                        licenseMaster.CREATECOMPANYID = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
                        licenseMaster.CREATEDEPARTMENTID = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
                        licenseMaster.CREATEPOSTID = Common.CurrentLoginUserInfo.UserPosts[0].PostID;

                        licenseMaster.CREATEDATE = DateTime.Now;

                        licenseMatserObjList.Add(licenseMaster);
                    }
                }
            }
        }