public MainOfferPriceInfo GetMainOfferPriceInfoById(int MainOfferPriceId)
        {
            MainOfferPriceInfo mainOfferPriceInfo  = null;//
            try
            {
                 mainOfferPriceInfo = new MainOfferPriceInfo(MainOfferPriceId);

            }
            catch (AppException)
            {
                return null;
            }

            return  mainOfferPriceInfo;
        }
 public object SaveMainOfferPriceInfo(MainOfferPriceInfo mainOfferPriceInfo)
 {
     mainOfferPriceInfo.Save();
     return mainOfferPriceInfo . MainOfferPriceId;
 }
 public void DeleteById(MainOfferPriceInfo pMainOfferPriceInfo)
 {
     MainOfferPriceInfo mainOfferPriceInfo = new MainOfferPriceInfo(pMainOfferPriceInfo.MainOfferPriceId);
     mainOfferPriceInfo.Delete();
 }
Example #4
0
 //数据持久化
 internal static void SaveToDb(MainOfferPriceInfo pMainOfferPriceInfo, MainOfferPrice  pMainOfferPrice,bool pIsNew)
 {
     pMainOfferPrice.MainOfferPriceId = pMainOfferPriceInfo.mainOfferPriceId;
      		pMainOfferPrice.MainOfferPriceName = pMainOfferPriceInfo.mainOfferPriceName;
     pMainOfferPrice.IsNew=pIsNew;
     string UserName = SubsonicHelper.GetUserName();
     try
     {
         pMainOfferPrice.Save(UserName);
     }
     catch(Exception ex)
     {
         LogManager.getInstance().getLogger(typeof(MainOfferPriceInfo)).Error(ex);
         if(ex.Message.Contains("插入重复键"))//违反了唯一键
         {
             throw new AppException("此对象已经存在");//此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
         }
         throw new AppException("保存失败");
     }
     pMainOfferPriceInfo.mainOfferPriceId = pMainOfferPrice.MainOfferPriceId;
     //如果缓存存在,更新缓存
     if (CachedEntityCommander.IsTypeRegistered(typeof(MainOfferPriceInfo)))
     {
         ResetCache();
     }
 }
Example #5
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (IsPageValid())
            {
                try
                {
                    EmployeeInfo em = (EmployeeInfo)Session["Employee"];
                    MainOfferPriceInfo mainop = new MainOfferPriceInfo();
                    mainop.Save();

                    int OpId = Convert.ToInt32(Request["OfferPriceId"].ToString());
                    OfferPriceInfo op = new OfferPriceInfo(OpId);
                    op.MainOfferPriceId = mainop.MainOfferPriceId;

                    if (ddlProject.SelectedValue != "")
                    {
                        op.MainProjectCreateId = Convert.ToInt32(ddlProject.SelectedValue);
                    }
                    if (ddlEmployee.SelectedValue != "")
                    {
                        op.EmployeeId = Convert.ToInt32(ddlEmployee.SelectedValue);
                    }

                    op.OfferPriceTypeId = Convert.ToInt32(rblType.SelectedValue);

                    DateTime date = DateTime.Now;
                    string strtoday = DateTime.Now.ToString("yyyyMMdd").Substring(2);
                    op.Today = strtoday;
                    op.SheetNum = txtSheetNum.Text.ToString();

                    op.FillTableDate = Convert.ToDateTime(txtFillTableDate.Text.ToString());
                    op.SectionView = txtSectionView.Text.ToString();
                    op.SheetNum = txtSheetNum.Text.ToString();
                    op.ProjectDes = txtProjectDes.Text.ToString();
                    op.MoneySum = txtMoneySum.Text.ToString();
                    op.BigMoney = txtBigMoney.Text.ToString();
                    op.ProductMoneySum = lblMoneySum.Text.ToString();
                    if (UpFile.HasFile == true)
                    {
                        string name = this.UpFile.FileName;
                        int startindex = this.UpFile.FileName.LastIndexOf(@"\") + 1;
                        string fileName = this.UpFile.FileName.Substring(startindex);
                        string phyFileName = this.Server.MapPath(@"~\Files\" + "OfferPrice") + @"\" + fileName;
                        this.UpFile.SaveAs(phyFileName);

                        OfferFileInfo of = new OfferFileInfo();
                        of.OfferFileName = fileName;//�ļ���
                        of.PhyFileName = UpFile.PostedFile.FileName;//�����ļ�·��
                        of.Save();
                        op.OfferFileId = Convert.ToInt32(of.OfferFileId);
                    }

                    op.SendEmployeeName = em.EmployeeName;
                    op.SendEmployeeId = em.EmployeeId;
                    op.PreIsApply = 1;
                    op.PreIsOver = 1;

                    op.IsApply = 0;
                    op.IsApprove = 0;
                    op.IsApply1 = 0;
                    op.IsApply2 = 0;
                    op.IsOver1 = 0;
                    op.IsOver2 = 0;

                    //GridViewǶ���ж�
                    op.IsMain = 1;
                    op.IsMain1 = 1;
                    op.IsMain2 = 1;
                    op.IsMain3 = 1;
                    op.IsNewCreate = 0;
                    op.IsSignName = 0;
                    op.Save();

                    if (UpFile.HasFile)
                    {
                        ////�ļ��ϴ���ַ��Ŀ¼������ͨ��IIS���豾������ΪFTP������
                        //string FileSaveUri = @"ftp://192.168.11.70/www/Files/OfferPrice/";
                        ////FTP�û������룬���DZ������û�������
                        //string ftpUser = "******";
                        //string ftpPassWord = "******";
                        //SendFiles(FileSaveUri, ftpUser, ftpPassWord);
                        this.UpFile.PostedFile.SaveAs(Server.MapPath("~/Files/OfferPrice/" + UpFile.FileName));

                    }

                    Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('��ӳɹ���');</script>");

                    ViewState["Isbtn"] = "1";
                    txtSheetNum.Text = SheetNums.SheetNumOfOP("BJTB", strtoday);
                    gvProductInitBind();
                }
                catch (Exception Ex)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('���ʧ�ܣ�" + Ex.Message + "');", true);
                }
            }
        }
Example #6
0
 //从后台获取数据
 internal static void LoadFromDAL(MainOfferPriceInfo pMainOfferPriceInfo, MainOfferPrice  pMainOfferPrice)
 {
     pMainOfferPriceInfo.mainOfferPriceId = pMainOfferPrice.MainOfferPriceId;
      		pMainOfferPriceInfo.mainOfferPriceName = pMainOfferPrice.MainOfferPriceName;
     pMainOfferPriceInfo.Loaded=true;
 }
Example #7
0
 /// <summary>
 /// 批量装载
 /// </summary>
 internal static void LoadFromDALPatch(List< MainOfferPriceInfo> pList, MainOfferPriceCollection pCollection)
 {
     foreach (MainOfferPrice mainOfferPrice in pCollection)
     {
         MainOfferPriceInfo mainOfferPriceInfo = new MainOfferPriceInfo();
         LoadFromDAL(mainOfferPriceInfo, mainOfferPrice );
         pList.Add(mainOfferPriceInfo);
     }
 }
Example #8
0
 /// <summary>
 /// 复制为另一个对象
 /// </summary>
 /// <param name="pIndustryTypeInfoTo"></param>
 public void CopyTo(MainOfferPriceInfo pMainOfferPriceInfoTo)
 {
     Copy(this,  pMainOfferPriceInfoTo);
 }
Example #9
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<MainOfferPriceInfo> GetPagedList(int pPageIndex,int pPageSize,SortDirection pOrderBy,string pSortExpression,out int pRecordCount)
        {
            if(pPageIndex<=1)
            pPageIndex=1;
            List< MainOfferPriceInfo> list = new List< MainOfferPriceInfo>();

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

            foreach (MainOfferPrice  mainOfferPrice  in collection)
            {
                MainOfferPriceInfo mainOfferPriceInfo = new MainOfferPriceInfo();
                LoadFromDAL(mainOfferPriceInfo,   mainOfferPrice);
                list.Add(mainOfferPriceInfo);
            }
            pRecordCount=q.GetRecordCount();

            return list;
        }
Example #10
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 /// <returns></returns>
 public static List<MainOfferPriceInfo> GetList()
 {
     string cacheKey = GetCacheKey();
     //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
     if (CachedEntityCommander.IsTypeRegistered(typeof(MainOfferPriceInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
     {
         return CachedEntityCommander.GetCache(cacheKey) as List< MainOfferPriceInfo>;
     }
     else
     {
         List< MainOfferPriceInfo>  list =new List< MainOfferPriceInfo>();
         MainOfferPriceCollection  collection=new  MainOfferPriceCollection();
         Query qry = new Query(MainOfferPrice.Schema);
         collection.LoadAndCloseReader(qry.ExecuteReader());
         foreach(MainOfferPrice mainOfferPrice in collection)
         {
             MainOfferPriceInfo mainOfferPriceInfo= new MainOfferPriceInfo();
             LoadFromDAL(mainOfferPriceInfo,mainOfferPrice);
             list.Add(mainOfferPriceInfo);
         }
       	//生成缓存
         if (CachedEntityCommander.IsTypeRegistered(typeof(MainOfferPriceInfo)))
         {
             CachedEntityCommander.SetCache(cacheKey, list);
         }
         return list;
     }
 }
Example #11
0
 /// <summary>
 /// 复制一个对象,采用硬编码的方式,避免反射的低效
 /// </summary>
 /// <param name="pIndustryTypeInfoFrom"></param>
 /// <param name="pIndustryTypeInfoTo"></param>
 public static void Copy(MainOfferPriceInfo pMainOfferPriceInfoFrom, MainOfferPriceInfo pMainOfferPriceInfoTo)
 {
     pMainOfferPriceInfoTo.MainOfferPriceId = pMainOfferPriceInfoFrom.mainOfferPriceId;
      		pMainOfferPriceInfoTo.MainOfferPriceName = pMainOfferPriceInfoFrom.mainOfferPriceName;
     pMainOfferPriceInfoTo.Loaded=pMainOfferPriceInfoFrom.Loaded;
 }
Example #12
0
        public void DeleteById(MainOfferPriceInfo pMainOfferPriceInfo)
        {
            MainOfferPriceInfo mainOfferPriceInfo = new MainOfferPriceInfo(pMainOfferPriceInfo.MainOfferPriceId);

            mainOfferPriceInfo.Delete();
        }