Exemple #1
0
        /// <summary>
        /// 获得分页列表,无论是否是缓存实体都从数据库直接拿取数据
        /// </summary>
        /// <param name="pPageIndex">页数</param>
        /// <param name="pPageSize">每页列表</param>
        /// <param name="pOrderBy">排序</param>
        /// <param name="pSortExpression">排序字段</param>
        /// <param name="pRecordCount">列表行数</param>
        /// <returns>数据分页</returns>
        public static List <ContractApplyInfo> GetPagedList(int pPageIndex, int pPageSize, SortDirection pOrderBy, string pSortExpression, out int pRecordCount)
        {
            if (pPageIndex <= 1)
            {
                pPageIndex = 1;
            }
            List <ContractApplyInfo> list = new List <ContractApplyInfo>();

            Query q = ContractApply.CreateQuery();

            q.PageIndex = pPageIndex;
            q.PageSize  = pPageSize;
            q.ORDER_BY(pSortExpression, pOrderBy.ToString());
            ContractApplyCollection collection = new  ContractApplyCollection();

            collection.LoadAndCloseReader(q.ExecuteReader());

            foreach (ContractApply contractApply  in collection)
            {
                ContractApplyInfo contractApplyInfo = new ContractApplyInfo();
                LoadFromDAL(contractApplyInfo, contractApply);
                list.Add(contractApplyInfo);
            }
            pRecordCount = q.GetRecordCount();

            return(list);
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (rblOver.SelectedIndex == -1)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('请选择修正或通过!');</script>");
            }
            else
            {
                try
                {
                    int cid = Convert.ToInt32(Request["ContractApplyId"].ToString());
                    ContractApplyInfo ca = new ContractApplyInfo(cid);
                    ca.SectionView = txtSectionView.Text.ToString();

                    if (rblOver.Items[0].Selected)
                    {
                        ca.State = 2;
                        ca.Save();
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('您让申请人修正!');</script>");
                    }
                    else if (rblOver.Items[1].Selected)
                    {

                        ca.State = 3;
                        ca.Save();
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('审批通过!');</script>");
                    }

                }
                catch (Exception Ex)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('保存失败:" + Ex.Message + "');", true);
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        /// <returns></returns>
        public static List <ContractApplyInfo> GetList()
        {
            string cacheKey = GetCacheKey();

            //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
            if (CachedEntityCommander.IsTypeRegistered(typeof(ContractApplyInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
            {
                return(CachedEntityCommander.GetCache(cacheKey) as List <ContractApplyInfo>);
            }
            else
            {
                List <ContractApplyInfo> list       = new List <ContractApplyInfo>();
                ContractApplyCollection  collection = new  ContractApplyCollection();
                Query qry = new Query(ContractApply.Schema);
                collection.LoadAndCloseReader(qry.ExecuteReader());
                foreach (ContractApply contractApply in collection)
                {
                    ContractApplyInfo contractApplyInfo = new ContractApplyInfo();
                    LoadFromDAL(contractApplyInfo, contractApply);
                    list.Add(contractApplyInfo);
                }
                //生成缓存
                if (CachedEntityCommander.IsTypeRegistered(typeof(ContractApplyInfo)))
                {
                    CachedEntityCommander.SetCache(cacheKey, list);
                }
                return(list);
            }
        }
 protected void btnDownLoad_Click(object sender, EventArgs e)
 {
     int cid = Convert.ToInt32(Request["ContractApplyId"].ToString());
     ContractApplyInfo ca = new ContractApplyInfo(cid);
     int fileid = Convert.ToInt32(ca.ContractFileId);
     Response.Redirect("DownLoadFile.aspx?fileid=" + fileid);
 }
Exemple #5
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     int fid = Convert.ToInt32(((Button)sender).CommandArgument.ToString());
     ContractApplyInfo ca = new ContractApplyInfo(fid);
     ca.ApplyTime = DateTime.Now.ToString();
     ca.State = 3;
     ca.Save();
     gvDataBind();
 }
Exemple #6
0
 /// <summary>
 /// 批量装载
 /// </summary>
 internal static void LoadFromDALPatch(List <ContractApplyInfo> pList, ContractApplyCollection pCollection)
 {
     foreach (ContractApply contractApply in pCollection)
     {
         ContractApplyInfo contractApplyInfo = new ContractApplyInfo();
         LoadFromDAL(contractApplyInfo, contractApply);
         pList.Add(contractApplyInfo);
     }
 }
Exemple #7
0
        protected void gvContract_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                //鼠标移动到每项时颜色交替效果
                e.Row.Attributes.Add("onmouseover", "e=this.style.backgroundColor; this.style.backgroundColor='#c1ebff'");
                e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=e");
                //设置悬浮鼠标指针形状为"小手"
                e.Row.Attributes["style"] = "Cursor:hand";

                if (!Convert.IsDBNull(gvContract.DataKeys[e.Row.RowIndex].Value))
                {
                    int cid = Convert.ToInt32(gvContract.DataKeys[e.Row.RowIndex].Value);
                    ContractApplyInfo CA = new ContractApplyInfo(cid);
                    if (CA.State != 0)
                    {
                        Button btnSubmit = e.Row.FindControl("btnSubmit") as Button;
                        Button btnEdit = e.Row.FindControl("btnEdit") as Button;
                        Button btnDelete = e.Row.FindControl("btnDelete") as Button;
                        btnSubmit.Enabled = false;
                        btnEdit.Enabled = false;
                        btnDelete.Enabled = false;
                    }
                    Label lblState = e.Row.FindControl("lblState") as Label;
                    switch (CA.State)
                    {
                        case 0:
                            lblState.Text = "未提交";
                            break;
                        case 1:
                            lblState.Text = "待部门领导审批";
                            break;
                        case 2:
                            lblState.Text = "部门:修正";
                            break;
                        case 3:
                            lblState.Text = "待总经理审批";
                            break;
                        case 4:
                            lblState.Text = "通过";
                            break;
                        case 5:
                            lblState.Text = "总经理:修正";
                            break;
                        default:
                            lblState.Text = "其他状态";
                            break;
                    }
                }
            }
        }
        public ContractApplyInfo GetContractApplyInfoById(int ContractApplyId)
        {
            ContractApplyInfo contractApplyInfo = null;             //

            try
            {
                contractApplyInfo = new ContractApplyInfo(ContractApplyId);
            }
            catch (AppException)
            {
                return(null);
            }

            return(contractApplyInfo);
        }
        public ContractApplyInfo GetContractApplyInfoById(int ContractApplyId)
        {
            ContractApplyInfo contractApplyInfo  = null;//
            try
            {
                 contractApplyInfo = new ContractApplyInfo(ContractApplyId);

            }
            catch (AppException)
            {
                return null;
            }

            return  contractApplyInfo;
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (rblOver.SelectedIndex == -1)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('请选择修正或通过!');</script>");
            }
            else
            {
                try
                {
                    int cid = Convert.ToInt32(Request["ContractApplyId"].ToString());
                    ContractApplyInfo ca = new ContractApplyInfo(cid);
                    ca.ManagerView = txtMangerView.Text.ToString();

                    if (rblOver.Items[0].Selected)
                    {
                        ca.State = 5;
                        ca.Save();

                        Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('您让申请人修正!');</script>");
                    }
                    else if (rblOver.Items[1].Selected)
                    {

                        ca.State = 4;
                        ca.Save();

                        Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('审批通过!');</script>");

                        ContractInfo ct = new ContractInfo();
                        ct.BeginDate = ca.BeginDate.ToString();
                        ct.ContractFileId = Convert.ToInt32(ca.ContractFileId);
                        ct.ContractName = ca.ContractName.ToString();
                        ct.ContractNum = ca.ContractNum.ToString();
                        ct.MoneySum = ca.SmallMoney.ToString();
                        ct.SignName = ca.SignName.ToString();
                        ct.Save();
                    }

                }
                catch (Exception Ex)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('保存失败:" + Ex.Message + "');", true);
                }
            }
        }
Exemple #11
0
        private void PageInit()
        {
            int cid = Convert.ToInt32(Request["ContractApplyId"].ToString());
            ContractApplyInfo ca = new ContractApplyInfo(cid);

            lblDepart.Text = ca.DepartName.ToString();
            lblEmployee.Text = ca.ApplyName.ToString();
            lblSignName.Text = ca.SignName.ToString();
            lblContractNum.Text = ca.ContractNum.ToString();
            lblSheetNum.Text = ca.SheetNum.ToString();
            lblContract.Text = ca.ContractName.ToString();
            lblBeginDate.Text = ca.BeginDate.ToString();
            lblApplyDate.Text = ca.ApplyDate.ToString();
            lblContractDes.Text = ca.ContractDes.ToString();
            lblBigMoney.Text = ca.BigMoney.ToString();
            lblSmallMoney.Text = ca.SmallMoney.ToString();
        }
Exemple #12
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (IsPageValid())
            {
                try
                {
                    ContractApplyInfo CA = new ContractApplyInfo();
                    ContractFileInfo cf = new ContractFileInfo();
                    if (UpFile.HasFile)
                    {
                        this.UpFile.PostedFile.SaveAs(Server.MapPath("~/Files/Contract/" + UpFile.FileName));
                       // cf.PhyFileName = UpFile.PostedFile.FileName;
                        cf.ContractFileName = UpFile.FileName.ToString();
                        cf.Save();
                        CA.ContractFileId = Convert.ToInt32(cf.ContractFileId);
                    }
                    CA.BeginDate = txtBeginDate.Text.ToString();
                    CA.SignName=ddlAuto.SelectedItem.Text.ToString();
                    CA.ContractName = txtContractName.Text.ToString();
                    CA.ContractNum=txtContractNum.Text.ToString();
                    CA.SheetNum = txtSheetNum.Text.ToString();
                    CA.Today = DateTime.Now.ToString("yyyyMMdd").Substring(2);
                    CA.BeginDate=txtBeginDate.Text.ToString();
                    CA.ApplyDate=txtApplyDate.Text.ToString();
                    CA.ContractDes=txtContractDes.Text.ToString();
                    CA.BigMoney=txtBigMoney.Text.ToString();
                    CA.SmallMoney=txtSmallMoney.Text.ToString();
                    CA.UseStampType=rblSignType.SelectedItem.Text.ToString();
                    CA.IsMoney=0;
                    if (ckbIsMoney.Checked)
                    {
                        CA.IsMoney = 1;
                    }
                    CA.ApplyName=lblEmployee.Text.ToString();
                    CA.DepartName=lblDepart.Text.ToString();
                    CA.State=0;
                    CA.Save();
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('保存成功!');</script>");

                }
                catch (Exception Ex)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('保存失败:" + Ex.Message + "');", true);
                }
            }
        }
Exemple #13
0
        //数据持久化
        internal static void  SaveToDb(ContractApplyInfo pContractApplyInfo, ContractApply pContractApply, bool pIsNew)
        {
            pContractApply.ContractApplyId = pContractApplyInfo.contractApplyId;
            pContractApply.ContractFileId  = pContractApplyInfo.contractFileId;
            pContractApply.SignName        = pContractApplyInfo.signName;
            pContractApply.ContractNum     = pContractApplyInfo.contractNum;
            pContractApply.SheetNum        = pContractApplyInfo.sheetNum;
            pContractApply.Today           = pContractApplyInfo.today;
            pContractApply.ContractName    = pContractApplyInfo.contractName;
            pContractApply.BeginDate       = pContractApplyInfo.beginDate;
            pContractApply.ApplyDate       = pContractApplyInfo.applyDate;
            pContractApply.ContractDes     = pContractApplyInfo.contractDes;
            pContractApply.BigMoney        = pContractApplyInfo.bigMoney;
            pContractApply.SmallMoney      = pContractApplyInfo.smallMoney;
            pContractApply.UseStampType    = pContractApplyInfo.useStampType;
            pContractApply.SectionView     = pContractApplyInfo.sectionView;
            pContractApply.ManagerView     = pContractApplyInfo.managerView;
            pContractApply.IsMoney         = pContractApplyInfo.isMoney;
            pContractApply.ApplyTime       = pContractApplyInfo.applyTime;
            pContractApply.ApplyName       = pContractApplyInfo.applyName;
            pContractApply.DepartName      = pContractApplyInfo.departName;
            pContractApply.State           = pContractApplyInfo.state;
            pContractApply.IsNew           = pIsNew;
            string UserName = SubsonicHelper.GetUserName();

            try
            {
                pContractApply.Save(UserName);
            }
            catch (Exception ex)
            {
                LogManager.getInstance().getLogger(typeof(ContractApplyInfo)).Error(ex);
                if (ex.Message.Contains("插入重复键"))               //违反了唯一键
                {
                    throw new AppException("此对象已经存在");          //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
                }
                throw new AppException("保存失败");
            }
            pContractApplyInfo.contractApplyId = pContractApply.ContractApplyId;
            //如果缓存存在,更新缓存
            if (CachedEntityCommander.IsTypeRegistered(typeof(ContractApplyInfo)))
            {
                ResetCache();
            }
        }
Exemple #14
0
 private void LoadFromId(int contractApplyId)
 {
     if (CachedEntityCommander.IsTypeRegistered(typeof(ContractApplyInfo)))
     {
         ContractApplyInfo contractApplyInfo = Find(GetList(), contractApplyId);
         if (contractApplyInfo == null)
         {
             throw new AppException("未能在缓存中找到相应的键值对象");
         }
         Copy(contractApplyInfo, this);
     }
     else
     {
         ContractApply contractApply = new ContractApply(contractApplyId);
         if (contractApply.IsNew)
         {
             throw new AppException("尚未初始化");
         }
         LoadFromDAL(this, contractApply);
     }
 }
Exemple #15
0
 protected void ContractBind()
 {
     int caId = Convert.ToInt32(Request["ContractApplyId"].ToString());
     ContractApplyInfo CA = new ContractApplyInfo(caId);
     lblDepart.Text = CA.DepartName.ToString();
     lblEmployee.Text = CA.ApplyName.ToString();
     txtBeginDate.Text = CA.BeginDate.ToString();
     txtContractNum.Text = CA.SheetNum.ToString();
     txtContractName.Text = CA.ContractName.ToString();
     txtSheetNum.Text = CA.SheetNum.ToString();
     txtApplyDate.Text = CA.ApplyDate.ToString();
     txtContractDes.Text = CA.ContractDes.ToString();
     txtSmallMoney.Text = CA.SmallMoney.ToString();
     txtBigMoney.Text = CA.BigMoney.ToString();
     if (CA.IsMoney == 0)
     {
         ckbIsMoney.Checked = false;
     }
     else
     {
         ckbIsMoney.Checked = true;
     }
 }
Exemple #16
0
 /// <summary>
 /// 复制一个对象,采用硬编码的方式,避免反射的低效
 /// </summary>
 /// <param name="pIndustryTypeInfoFrom"></param>
 /// <param name="pIndustryTypeInfoTo"></param>
 public static void Copy(ContractApplyInfo pContractApplyInfoFrom, ContractApplyInfo pContractApplyInfoTo)
 {
     pContractApplyInfoTo.ContractApplyId = pContractApplyInfoFrom.contractApplyId;
     pContractApplyInfoTo.ContractFileId  = pContractApplyInfoFrom.contractFileId;
     pContractApplyInfoTo.SignName        = pContractApplyInfoFrom.signName;
     pContractApplyInfoTo.ContractNum     = pContractApplyInfoFrom.contractNum;
     pContractApplyInfoTo.SheetNum        = pContractApplyInfoFrom.sheetNum;
     pContractApplyInfoTo.Today           = pContractApplyInfoFrom.today;
     pContractApplyInfoTo.ContractName    = pContractApplyInfoFrom.contractName;
     pContractApplyInfoTo.BeginDate       = pContractApplyInfoFrom.beginDate;
     pContractApplyInfoTo.ApplyDate       = pContractApplyInfoFrom.applyDate;
     pContractApplyInfoTo.ContractDes     = pContractApplyInfoFrom.contractDes;
     pContractApplyInfoTo.BigMoney        = pContractApplyInfoFrom.bigMoney;
     pContractApplyInfoTo.SmallMoney      = pContractApplyInfoFrom.smallMoney;
     pContractApplyInfoTo.UseStampType    = pContractApplyInfoFrom.useStampType;
     pContractApplyInfoTo.SectionView     = pContractApplyInfoFrom.sectionView;
     pContractApplyInfoTo.ManagerView     = pContractApplyInfoFrom.managerView;
     pContractApplyInfoTo.IsMoney         = pContractApplyInfoFrom.isMoney;
     pContractApplyInfoTo.ApplyTime       = pContractApplyInfoFrom.applyTime;
     pContractApplyInfoTo.ApplyName       = pContractApplyInfoFrom.applyName;
     pContractApplyInfoTo.DepartName      = pContractApplyInfoFrom.departName;
     pContractApplyInfoTo.State           = pContractApplyInfoFrom.state;
     pContractApplyInfoTo.Loaded          = pContractApplyInfoFrom.Loaded;
 }
Exemple #17
0
 //从后台获取数据
 internal static void  LoadFromDAL(ContractApplyInfo pContractApplyInfo, ContractApply pContractApply)
 {
     pContractApplyInfo.contractApplyId = pContractApply.ContractApplyId;
     pContractApplyInfo.contractFileId  = pContractApply.ContractFileId;
     pContractApplyInfo.signName        = pContractApply.SignName;
     pContractApplyInfo.contractNum     = pContractApply.ContractNum;
     pContractApplyInfo.sheetNum        = pContractApply.SheetNum;
     pContractApplyInfo.today           = pContractApply.Today;
     pContractApplyInfo.contractName    = pContractApply.ContractName;
     pContractApplyInfo.beginDate       = pContractApply.BeginDate;
     pContractApplyInfo.applyDate       = pContractApply.ApplyDate;
     pContractApplyInfo.contractDes     = pContractApply.ContractDes;
     pContractApplyInfo.bigMoney        = pContractApply.BigMoney;
     pContractApplyInfo.smallMoney      = pContractApply.SmallMoney;
     pContractApplyInfo.useStampType    = pContractApply.UseStampType;
     pContractApplyInfo.sectionView     = pContractApply.SectionView;
     pContractApplyInfo.managerView     = pContractApply.ManagerView;
     pContractApplyInfo.isMoney         = pContractApply.IsMoney;
     pContractApplyInfo.applyTime       = pContractApply.ApplyTime;
     pContractApplyInfo.applyName       = pContractApply.ApplyName;
     pContractApplyInfo.departName      = pContractApply.DepartName;
     pContractApplyInfo.state           = pContractApply.State;
     pContractApplyInfo.Loaded          = true;
 }
Exemple #18
0
        /// <summary>
        /// 获得分页列表,无论是否是缓存实体都从数据库直接拿取数据
        /// </summary>
        /// <param name="pPageIndex">页数</param>
        /// <param name="pPageSize">每页列表</param>
        /// <param name="pOrderBy">排序</param>
        /// <param name="pSortExpression">排序字段</param>
        /// <param name="pRecordCount">列表行数</param>
        /// <returns>数据分页</returns>
        public static List<ContractApplyInfo> GetPagedList(int pPageIndex,int pPageSize,SortDirection pOrderBy,string pSortExpression,out int pRecordCount)
        {
            if(pPageIndex<=1)
            pPageIndex=1;
            List< ContractApplyInfo> list = new List< ContractApplyInfo>();

            Query q = ContractApply .CreateQuery();
            q.PageIndex = pPageIndex;
            q.PageSize = pPageSize;
            q.ORDER_BY(pSortExpression,pOrderBy.ToString());
            ContractApplyCollection  collection=new  ContractApplyCollection();
             	collection.LoadAndCloseReader(q.ExecuteReader());

            foreach (ContractApply  contractApply  in collection)
            {
                ContractApplyInfo contractApplyInfo = new ContractApplyInfo();
                LoadFromDAL(contractApplyInfo,   contractApply);
                list.Add(contractApplyInfo);
            }
            pRecordCount=q.GetRecordCount();

            return list;
        }
 public object  SaveContractApplyInfo(ContractApplyInfo contractApplyInfo)
 {
     contractApplyInfo.Save();
     return(contractApplyInfo.ContractApplyId);
 }
 public List <ContractApplyInfo> GetPagedList(int pPageIndex, int pPageSize, SortDirection pOrderBy, string pSortExpression, out int pRecordCount)
 {
     return(ContractApplyInfo.GetPagedList(pPageIndex, pPageSize, pOrderBy, pSortExpression, out pRecordCount));
 }
 public List <ContractApplyInfo> GetContractApplyInfoList()
 {
     return(ContractApplyInfo.GetList());
 }
 public object SaveContractApplyInfo(ContractApplyInfo contractApplyInfo)
 {
     contractApplyInfo.Save();
     return contractApplyInfo . ContractApplyId;
 }
        public void DeleteById(ContractApplyInfo pContractApplyInfo)
        {
            ContractApplyInfo contractApplyInfo = new ContractApplyInfo(pContractApplyInfo.ContractApplyId);

            contractApplyInfo.Delete();
        }
Exemple #24
0
 /// <summary>
 /// 复制一个对象,采用硬编码的方式,避免反射的低效
 /// </summary>
 /// <param name="pIndustryTypeInfoFrom"></param>
 /// <param name="pIndustryTypeInfoTo"></param>
 public static void Copy(ContractApplyInfo pContractApplyInfoFrom, ContractApplyInfo pContractApplyInfoTo)
 {
     pContractApplyInfoTo.ContractApplyId = pContractApplyInfoFrom.contractApplyId;
      		pContractApplyInfoTo.ContractFileId = pContractApplyInfoFrom.contractFileId;
      		pContractApplyInfoTo.SignName = pContractApplyInfoFrom.signName;
      		pContractApplyInfoTo.ContractNum = pContractApplyInfoFrom.contractNum;
      		pContractApplyInfoTo.SheetNum = pContractApplyInfoFrom.sheetNum;
      		pContractApplyInfoTo.Today = pContractApplyInfoFrom.today;
      		pContractApplyInfoTo.ContractName = pContractApplyInfoFrom.contractName;
      		pContractApplyInfoTo.BeginDate = pContractApplyInfoFrom.beginDate;
      		pContractApplyInfoTo.ApplyDate = pContractApplyInfoFrom.applyDate;
      		pContractApplyInfoTo.ContractDes = pContractApplyInfoFrom.contractDes;
      		pContractApplyInfoTo.BigMoney = pContractApplyInfoFrom.bigMoney;
      		pContractApplyInfoTo.SmallMoney = pContractApplyInfoFrom.smallMoney;
      		pContractApplyInfoTo.UseStampType = pContractApplyInfoFrom.useStampType;
      		pContractApplyInfoTo.SectionView = pContractApplyInfoFrom.sectionView;
      		pContractApplyInfoTo.ManagerView = pContractApplyInfoFrom.managerView;
      		pContractApplyInfoTo.IsMoney = pContractApplyInfoFrom.isMoney;
      		pContractApplyInfoTo.ApplyTime = pContractApplyInfoFrom.applyTime;
      		pContractApplyInfoTo.ApplyName = pContractApplyInfoFrom.applyName;
      		pContractApplyInfoTo.DepartName = pContractApplyInfoFrom.departName;
      		pContractApplyInfoTo.State = pContractApplyInfoFrom.state;
     pContractApplyInfoTo.Loaded=pContractApplyInfoFrom.Loaded;
 }
Exemple #25
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 /// <returns></returns>
 public static List<ContractApplyInfo> GetList()
 {
     string cacheKey = GetCacheKey();
     //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
     if (CachedEntityCommander.IsTypeRegistered(typeof(ContractApplyInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
     {
         return CachedEntityCommander.GetCache(cacheKey) as List< ContractApplyInfo>;
     }
     else
     {
         List< ContractApplyInfo>  list =new List< ContractApplyInfo>();
         ContractApplyCollection  collection=new  ContractApplyCollection();
         Query qry = new Query(ContractApply.Schema);
         collection.LoadAndCloseReader(qry.ExecuteReader());
         foreach(ContractApply contractApply in collection)
         {
             ContractApplyInfo contractApplyInfo= new ContractApplyInfo();
             LoadFromDAL(contractApplyInfo,contractApply);
             list.Add(contractApplyInfo);
         }
       	//生成缓存
         if (CachedEntityCommander.IsTypeRegistered(typeof(ContractApplyInfo)))
         {
             CachedEntityCommander.SetCache(cacheKey, list);
         }
         return list;
     }
 }
Exemple #26
0
 /// <summary>
 /// 复制为另一个对象
 /// </summary>
 /// <param name="pIndustryTypeInfoTo"></param>
 public void CopyTo(ContractApplyInfo pContractApplyInfoTo)
 {
     Copy(this,  pContractApplyInfoTo);
 }
Exemple #27
0
 //从后台获取数据
 internal static void LoadFromDAL(ContractApplyInfo pContractApplyInfo, ContractApply  pContractApply)
 {
     pContractApplyInfo.contractApplyId = pContractApply.ContractApplyId;
      		pContractApplyInfo.contractFileId = pContractApply.ContractFileId;
      		pContractApplyInfo.signName = pContractApply.SignName;
      		pContractApplyInfo.contractNum = pContractApply.ContractNum;
      		pContractApplyInfo.sheetNum = pContractApply.SheetNum;
      		pContractApplyInfo.today = pContractApply.Today;
      		pContractApplyInfo.contractName = pContractApply.ContractName;
      		pContractApplyInfo.beginDate = pContractApply.BeginDate;
      		pContractApplyInfo.applyDate = pContractApply.ApplyDate;
      		pContractApplyInfo.contractDes = pContractApply.ContractDes;
      		pContractApplyInfo.bigMoney = pContractApply.BigMoney;
      		pContractApplyInfo.smallMoney = pContractApply.SmallMoney;
      		pContractApplyInfo.useStampType = pContractApply.UseStampType;
      		pContractApplyInfo.sectionView = pContractApply.SectionView;
      		pContractApplyInfo.managerView = pContractApply.ManagerView;
      		pContractApplyInfo.isMoney = pContractApply.IsMoney;
      		pContractApplyInfo.applyTime = pContractApply.ApplyTime;
      		pContractApplyInfo.applyName = pContractApply.ApplyName;
      		pContractApplyInfo.departName = pContractApply.DepartName;
      		pContractApplyInfo.state = pContractApply.State;
     pContractApplyInfo.Loaded=true;
 }
Exemple #28
0
 /// <summary>
 /// 批量装载
 /// </summary>
 internal static void LoadFromDALPatch(List< ContractApplyInfo> pList, ContractApplyCollection pCollection)
 {
     foreach (ContractApply contractApply in pCollection)
     {
         ContractApplyInfo contractApplyInfo = new ContractApplyInfo();
         LoadFromDAL(contractApplyInfo, contractApply );
         pList.Add(contractApplyInfo);
     }
 }
Exemple #29
0
 /// <summary>
 /// 复制为另一个对象
 /// </summary>
 /// <param name="pIndustryTypeInfoTo"></param>
 public void CopyTo(ContractApplyInfo pContractApplyInfoTo)
 {
     Copy(this, pContractApplyInfoTo);
 }
Exemple #30
0
 //数据持久化
 internal static void SaveToDb(ContractApplyInfo pContractApplyInfo, ContractApply  pContractApply,bool pIsNew)
 {
     pContractApply.ContractApplyId = pContractApplyInfo.contractApplyId;
      		pContractApply.ContractFileId = pContractApplyInfo.contractFileId;
      		pContractApply.SignName = pContractApplyInfo.signName;
      		pContractApply.ContractNum = pContractApplyInfo.contractNum;
      		pContractApply.SheetNum = pContractApplyInfo.sheetNum;
      		pContractApply.Today = pContractApplyInfo.today;
      		pContractApply.ContractName = pContractApplyInfo.contractName;
      		pContractApply.BeginDate = pContractApplyInfo.beginDate;
      		pContractApply.ApplyDate = pContractApplyInfo.applyDate;
      		pContractApply.ContractDes = pContractApplyInfo.contractDes;
      		pContractApply.BigMoney = pContractApplyInfo.bigMoney;
      		pContractApply.SmallMoney = pContractApplyInfo.smallMoney;
      		pContractApply.UseStampType = pContractApplyInfo.useStampType;
      		pContractApply.SectionView = pContractApplyInfo.sectionView;
      		pContractApply.ManagerView = pContractApplyInfo.managerView;
      		pContractApply.IsMoney = pContractApplyInfo.isMoney;
      		pContractApply.ApplyTime = pContractApplyInfo.applyTime;
      		pContractApply.ApplyName = pContractApplyInfo.applyName;
      		pContractApply.DepartName = pContractApplyInfo.departName;
      		pContractApply.State = pContractApplyInfo.state;
     pContractApply.IsNew=pIsNew;
     string UserName = SubsonicHelper.GetUserName();
     try
     {
         pContractApply.Save(UserName);
     }
     catch(Exception ex)
     {
         LogManager.getInstance().getLogger(typeof(ContractApplyInfo)).Error(ex);
         if(ex.Message.Contains("插入重复键"))//违反了唯一键
         {
             throw new AppException("此对象已经存在");//此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
         }
         throw new AppException("保存失败");
     }
     pContractApplyInfo.contractApplyId = pContractApply.ContractApplyId;
     //如果缓存存在,更新缓存
     if (CachedEntityCommander.IsTypeRegistered(typeof(ContractApplyInfo)))
     {
         ResetCache();
     }
 }
 public void DeleteById(ContractApplyInfo pContractApplyInfo)
 {
     ContractApplyInfo contractApplyInfo = new ContractApplyInfo(pContractApplyInfo.ContractApplyId);
     contractApplyInfo.Delete();
 }