/// <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 <OfferPriceInfo> GetPagedList(int pPageIndex, int pPageSize, SortDirection pOrderBy, string pSortExpression, out int pRecordCount) { if (pPageIndex <= 1) { pPageIndex = 1; } List <OfferPriceInfo> list = new List <OfferPriceInfo>(); Query q = OfferPrice.CreateQuery(); q.PageIndex = pPageIndex; q.PageSize = pPageSize; q.ORDER_BY(pSortExpression, pOrderBy.ToString()); OfferPriceCollection collection = new OfferPriceCollection(); collection.LoadAndCloseReader(q.ExecuteReader()); foreach (OfferPrice offerPrice in collection) { OfferPriceInfo offerPriceInfo = new OfferPriceInfo(); LoadFromDAL(offerPriceInfo, offerPrice); list.Add(offerPriceInfo); } pRecordCount = q.GetRecordCount(); return(list); }
/// <summary> /// 获得数据列表 /// </summary> /// <returns></returns> public static List <OfferPriceInfo> GetList() { string cacheKey = GetCacheKey(); //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取 if (CachedEntityCommander.IsTypeRegistered(typeof(OfferPriceInfo)) && CachedEntityCommander.GetCache(cacheKey) != null) { return(CachedEntityCommander.GetCache(cacheKey) as List <OfferPriceInfo>); } else { List <OfferPriceInfo> list = new List <OfferPriceInfo>(); OfferPriceCollection collection = new OfferPriceCollection(); Query qry = new Query(OfferPrice.Schema); collection.LoadAndCloseReader(qry.ExecuteReader()); foreach (OfferPrice offerPrice in collection) { OfferPriceInfo offerPriceInfo = new OfferPriceInfo(); LoadFromDAL(offerPriceInfo, offerPrice); list.Add(offerPriceInfo); } //生成缓存 if (CachedEntityCommander.IsTypeRegistered(typeof(OfferPriceInfo))) { CachedEntityCommander.SetCache(cacheKey, list); } return(list); } }
protected void btnAddSale_Click(object sender, EventArgs e) { OfferPriceInfo op = new OfferPriceInfo(); op.Save(); int opid = Convert.ToInt32(op.OfferPriceId); Response.Redirect("AddPrice1.aspx?OfferPriceId=" + opid); }
/// <summary> /// 批量装载 /// </summary> internal static void LoadFromDALPatch(List <OfferPriceInfo> pList, OfferPriceCollection pCollection) { foreach (OfferPrice offerPrice in pCollection) { OfferPriceInfo offerPriceInfo = new OfferPriceInfo(); LoadFromDAL(offerPriceInfo, offerPrice); pList.Add(offerPriceInfo); } }
protected void btnDownLoad_Click(object sender, EventArgs e) { int opId = Convert.ToInt32(Request["OfferPriceId"].ToString()); OfferPriceInfo op = new OfferPriceInfo(opId); OfferFileInfo file = new OfferFileInfo(Convert.ToInt32(op.OfferFileId)); int fileid = Convert.ToInt32(file.OfferFileId); Response.Redirect("DownLoadFile.aspx?fileid="+fileid); }
public OfferPriceInfo GetOfferPriceInfoById(int OfferPriceId) { OfferPriceInfo offerPriceInfo = null; // try { offerPriceInfo = new OfferPriceInfo(OfferPriceId); } catch (AppException) { return(null); } return(offerPriceInfo); }
public OfferPriceInfo GetOfferPriceInfoById(int OfferPriceId) { OfferPriceInfo offerPriceInfo = null;// try { offerPriceInfo = new OfferPriceInfo(OfferPriceId); } catch (AppException) { return null; } return offerPriceInfo; }
//从后台获取数据 internal static void LoadFromDAL(OfferPriceInfo pOfferPriceInfo, OfferPrice pOfferPrice) { pOfferPriceInfo.offerPriceId = pOfferPrice.OfferPriceId; pOfferPriceInfo.employeeId = pOfferPrice.EmployeeId; pOfferPriceInfo.mainProjectCreateId = pOfferPrice.MainProjectCreateId; pOfferPriceInfo.mainOfferPriceId = pOfferPrice.MainOfferPriceId; pOfferPriceInfo.projectDes = pOfferPrice.ProjectDes; pOfferPriceInfo.sheetNum = pOfferPrice.SheetNum; pOfferPriceInfo.fillTableDate = pOfferPrice.FillTableDate; pOfferPriceInfo.finaceView = pOfferPrice.FinaceView; pOfferPriceInfo.sectionView = pOfferPrice.SectionView; pOfferPriceInfo.mangerView = pOfferPrice.MangerView; pOfferPriceInfo.isApply = pOfferPrice.IsApply; pOfferPriceInfo.isApply1 = pOfferPrice.IsApply1; pOfferPriceInfo.isApply2 = pOfferPrice.IsApply2; pOfferPriceInfo.isOver1 = pOfferPrice.IsOver1; pOfferPriceInfo.isOver2 = pOfferPrice.IsOver2; pOfferPriceInfo.applyTime = pOfferPrice.ApplyTime; pOfferPriceInfo.apply1Time = pOfferPrice.Apply1Time; pOfferPriceInfo.apply2Time = pOfferPrice.Apply2Time; pOfferPriceInfo.sendEmployeeId = pOfferPrice.SendEmployeeId; pOfferPriceInfo.recv1EmployeeId = pOfferPrice.Recv1EmployeeId; pOfferPriceInfo.recv2EmployeeId = pOfferPrice.Recv2EmployeeId; pOfferPriceInfo.sendEmployeeName = pOfferPrice.SendEmployeeName; pOfferPriceInfo.recv1EmployeeName = pOfferPrice.Recv1EmployeeName; pOfferPriceInfo.recv2EmployeeName = pOfferPrice.Recv2EmployeeName; pOfferPriceInfo.preEmployeeId = pOfferPrice.PreEmployeeId; pOfferPriceInfo.preEmployeeName = pOfferPrice.PreEmployeeName; pOfferPriceInfo.preIsApply = pOfferPrice.PreIsApply; pOfferPriceInfo.preIsOver = pOfferPrice.PreIsOver; pOfferPriceInfo.preApplyTime = pOfferPrice.PreApplyTime; pOfferPriceInfo.recvEmployeeId = pOfferPrice.RecvEmployeeId; pOfferPriceInfo.isMain = pOfferPrice.IsMain; pOfferPriceInfo.isMain1 = pOfferPrice.IsMain1; pOfferPriceInfo.isMain2 = pOfferPrice.IsMain2; pOfferPriceInfo.isMain3 = pOfferPrice.IsMain3; pOfferPriceInfo.isNewCreate = pOfferPrice.IsNewCreate; pOfferPriceInfo.isApprove = pOfferPrice.IsApprove; pOfferPriceInfo.approveTime = pOfferPrice.ApproveTime; pOfferPriceInfo.today = pOfferPrice.Today; pOfferPriceInfo.offerPriceTypeId = pOfferPrice.OfferPriceTypeId; pOfferPriceInfo.offerFileId = pOfferPrice.OfferFileId; pOfferPriceInfo.moneySum = pOfferPrice.MoneySum; pOfferPriceInfo.bigMoney = pOfferPrice.BigMoney; pOfferPriceInfo.productMoneySum = pOfferPrice.ProductMoneySum; pOfferPriceInfo.isSignName = pOfferPrice.IsSignName; pOfferPriceInfo.Loaded = true; }
/// <summary> /// 复制一个对象,采用硬编码的方式,避免反射的低效 /// </summary> /// <param name="pIndustryTypeInfoFrom"></param> /// <param name="pIndustryTypeInfoTo"></param> public static void Copy(OfferPriceInfo pOfferPriceInfoFrom, OfferPriceInfo pOfferPriceInfoTo) { pOfferPriceInfoTo.OfferPriceId = pOfferPriceInfoFrom.offerPriceId; pOfferPriceInfoTo.EmployeeId = pOfferPriceInfoFrom.employeeId; pOfferPriceInfoTo.MainProjectCreateId = pOfferPriceInfoFrom.mainProjectCreateId; pOfferPriceInfoTo.MainOfferPriceId = pOfferPriceInfoFrom.mainOfferPriceId; pOfferPriceInfoTo.ProjectDes = pOfferPriceInfoFrom.projectDes; pOfferPriceInfoTo.SheetNum = pOfferPriceInfoFrom.sheetNum; pOfferPriceInfoTo.FillTableDate = pOfferPriceInfoFrom.fillTableDate; pOfferPriceInfoTo.FinaceView = pOfferPriceInfoFrom.finaceView; pOfferPriceInfoTo.SectionView = pOfferPriceInfoFrom.sectionView; pOfferPriceInfoTo.MangerView = pOfferPriceInfoFrom.mangerView; pOfferPriceInfoTo.IsApply = pOfferPriceInfoFrom.isApply; pOfferPriceInfoTo.IsApply1 = pOfferPriceInfoFrom.isApply1; pOfferPriceInfoTo.IsApply2 = pOfferPriceInfoFrom.isApply2; pOfferPriceInfoTo.IsOver1 = pOfferPriceInfoFrom.isOver1; pOfferPriceInfoTo.IsOver2 = pOfferPriceInfoFrom.isOver2; pOfferPriceInfoTo.ApplyTime = pOfferPriceInfoFrom.applyTime; pOfferPriceInfoTo.Apply1Time = pOfferPriceInfoFrom.apply1Time; pOfferPriceInfoTo.Apply2Time = pOfferPriceInfoFrom.apply2Time; pOfferPriceInfoTo.SendEmployeeId = pOfferPriceInfoFrom.sendEmployeeId; pOfferPriceInfoTo.Recv1EmployeeId = pOfferPriceInfoFrom.recv1EmployeeId; pOfferPriceInfoTo.Recv2EmployeeId = pOfferPriceInfoFrom.recv2EmployeeId; pOfferPriceInfoTo.SendEmployeeName = pOfferPriceInfoFrom.sendEmployeeName; pOfferPriceInfoTo.Recv1EmployeeName = pOfferPriceInfoFrom.recv1EmployeeName; pOfferPriceInfoTo.Recv2EmployeeName = pOfferPriceInfoFrom.recv2EmployeeName; pOfferPriceInfoTo.PreEmployeeId = pOfferPriceInfoFrom.preEmployeeId; pOfferPriceInfoTo.PreEmployeeName = pOfferPriceInfoFrom.preEmployeeName; pOfferPriceInfoTo.PreIsApply = pOfferPriceInfoFrom.preIsApply; pOfferPriceInfoTo.PreIsOver = pOfferPriceInfoFrom.preIsOver; pOfferPriceInfoTo.PreApplyTime = pOfferPriceInfoFrom.preApplyTime; pOfferPriceInfoTo.RecvEmployeeId = pOfferPriceInfoFrom.recvEmployeeId; pOfferPriceInfoTo.IsMain = pOfferPriceInfoFrom.isMain; pOfferPriceInfoTo.IsMain1 = pOfferPriceInfoFrom.isMain1; pOfferPriceInfoTo.IsMain2 = pOfferPriceInfoFrom.isMain2; pOfferPriceInfoTo.IsMain3 = pOfferPriceInfoFrom.isMain3; pOfferPriceInfoTo.IsNewCreate = pOfferPriceInfoFrom.isNewCreate; pOfferPriceInfoTo.IsApprove = pOfferPriceInfoFrom.isApprove; pOfferPriceInfoTo.ApproveTime = pOfferPriceInfoFrom.approveTime; pOfferPriceInfoTo.Today = pOfferPriceInfoFrom.today; pOfferPriceInfoTo.OfferPriceTypeId = pOfferPriceInfoFrom.offerPriceTypeId; pOfferPriceInfoTo.OfferFileId = pOfferPriceInfoFrom.offerFileId; pOfferPriceInfoTo.MoneySum = pOfferPriceInfoFrom.moneySum; pOfferPriceInfoTo.BigMoney = pOfferPriceInfoFrom.bigMoney; pOfferPriceInfoTo.ProductMoneySum = pOfferPriceInfoFrom.productMoneySum; pOfferPriceInfoTo.IsSignName = pOfferPriceInfoFrom.isSignName; pOfferPriceInfoTo.Loaded = pOfferPriceInfoFrom.Loaded; }
protected void PageInit() { int opid = Convert.ToInt32(Request["OfferPriceId"].ToString()); OfferPriceInfo op = new OfferPriceInfo(opid); MainProjectCreateInfo project = new MainProjectCreateInfo(Convert.ToInt32(op.MainProjectCreateId)); lblProject.Text = project.ProjectName; lblProjectNum.Text = project.SheetNum; EmployeeInfo em = new EmployeeInfo(Convert.ToInt32(op.EmployeeId)); lblEmployee.Text = em.EmployeeName.ToString(); lblFillTableDate.Text = op.FillTableDate.ToString(); txtManagerView.Text = op.MangerView.ToString(); txtSectionView.Text = op.SectionView.ToString(); rblType.SelectedValue = op.OfferPriceTypeId.ToString(); txtProjectDes.Text = op.ProjectDes.ToString(); lblMoneySum.Text = op.ProductMoneySum.ToString(); if (op.OfferFileId.ToString() == "") { btnDownLoad.Enabled = false; } if (op.MoneySum != null) { lblMoneySum.Text = op.MoneySum.ToString(); } lblSheetNum.Text = op.SheetNum.ToString(); if (op.MoneySum != null) { lblMoneySum.Text = op.MoneySum.ToString(); } if (op.BigMoney != null) { lblBigMoney.Text = op.BigMoney.ToString(); } if (op.IsSignName == 1) { imgMarket.Visible = true; } else if (op.IsSignName == 2) { imgMarket.Visible = true; imgManager.Visible = true; } }
private void LoadFromId(int offerPriceId) { if (CachedEntityCommander.IsTypeRegistered(typeof(OfferPriceInfo))) { OfferPriceInfo offerPriceInfo = Find(GetList(), offerPriceId); if (offerPriceInfo == null) { throw new AppException("未能在缓存中找到相应的键值对象"); } Copy(offerPriceInfo, this); } else { OfferPrice offerPrice = new OfferPrice(offerPriceId); if (offerPrice.IsNew) { throw new AppException("尚未初始化"); } LoadFromDAL(this, offerPrice); } }
protected void btnSave_Click(object sender, EventArgs e) { if (IsPageValid()) { try { int wkid = Convert.ToInt32(Request["OfferPriceId"].ToString()); OfferPriceInfo pc = new OfferPriceInfo(wkid); pc.SectionView = txtSectionView.Text.ToString(); pc.IsApprove = 1; DateTime date = DateTime.Now; pc.ApproveTime = date; pc.IsSignName = 1; if (rblOver.Items[0].Selected) { pc.PreIsOver = 0; pc.IsNewCreate = 1; pc.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('����������������');</script>"); } else if (rblOver.Items[1].Selected) { pc.PreIsOver = 1; //int emid = Convert.ToInt32(Common.getEmployeeIdOfFinaceManager());//��������� //pc.Recv1EmployeeId = emid; int emid = Convert.ToInt32(Common.getEmployeeIdOfManager());//�ܾ������ pc.Recv2EmployeeId = emid; pc.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('����ͨ����');</script>"); } } catch (Exception Ex) { ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('����ʧ�ܣ�" + Ex.Message + "');", true); } } }
protected void btnSave_Click(object sender, EventArgs e) { if (Page.IsValid) { try { int opid = Convert.ToInt32(Request["OfferPriceId"].ToString()); OfferPriceInfo op = new OfferPriceInfo(opid); op.IsApply1 = 1; DateTime date = DateTime.Now; op.Apply1Time = date; MessageInfo.DelMessageOfMemo(opid.ToString()); if (rblOver.Items[0].Selected) { op.IsOver1 = 0; op.IsNewCreate = 1; op.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('����������������');</script>"); } else if (rblOver.Items[1].Selected) { op.IsOver1 = 1; //int emid = Convert.ToInt32(Common.getEmployeeIdOfManager()); //op.Recv2EmployeeId = emid; op.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('����ͨ����');</script>"); } Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('����ɹ���');</script>"); } catch (Exception Ex) { ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('����ʧ�ܣ�" + Ex.Message + "');", true); } } }
protected void btnSave_Click(object sender, EventArgs e) { if (IsPageValid()) { try { int opid = Convert.ToInt32(Request["OfferPriceId"].ToString()); OfferPriceInfo op = new OfferPriceInfo(opid); op.MangerView = txtManagerView.Text.ToString(); op.IsApply2 = 1; DateTime date = DateTime.Now; op.Apply2Time = date; op.IsSignName = 2; if (rblOver.Items[0].Selected) { op.IsOver2 = 0; op.IsNewCreate = 1; op.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('����������������');</script>"); MessageInfo.DelMessageOfMemo(opid.ToString()); } else if (rblOver.Items[1].Selected) { op.IsOver2 = 1; op.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('����ɹ���');</script>"); MessageInfo.DelMessageOfMemo(opid.ToString()); } } catch (Exception Ex) { ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('����ʧ�ܣ�" + Ex.Message + "');", true); } } }
/// <summary> /// 复制为另一个对象 /// </summary> /// <param name="pIndustryTypeInfoTo"></param> public void CopyTo(OfferPriceInfo pOfferPriceInfoTo) { Copy(this, pOfferPriceInfoTo); }
public object SaveOfferPriceInfo(OfferPriceInfo offerPriceInfo) { offerPriceInfo.Save(); return(offerPriceInfo.OfferPriceId); }
public List <OfferPriceInfo> GetPagedList(int pPageIndex, int pPageSize, SortDirection pOrderBy, string pSortExpression, out int pRecordCount) { return(OfferPriceInfo.GetPagedList(pPageIndex, pPageSize, pOrderBy, pSortExpression, out pRecordCount)); }
public List <OfferPriceInfo> GetOfferPriceInfoList() { return(OfferPriceInfo.GetList()); }
public object SaveOfferPriceInfo(OfferPriceInfo offerPriceInfo) { offerPriceInfo.Save(); return offerPriceInfo . OfferPriceId; }
protected void btnSubmit_Click(object sender, EventArgs e) { int wksumId = Convert.ToInt32(((Button)sender).CommandArgument.ToString()); OfferPriceInfo wksum = new OfferPriceInfo(wksumId); wksum.IsApply = 1; DateTime date = DateTime.Now; wksum.ApplyTime = date; //int recvemid = Convert.ToInt32(Common.getEmployeeIdOfFinaceManager());//ֻ�в������ܽ�����Ŀ����� int recvemid = Convert.ToInt32(Common.getEmployeeIdOfManager());//�ܾ������ wksum.Recv2EmployeeId = recvemid; wksum.Save(); gvDataBind(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('����ɹ���');</script>"); }
protected void btnSave_Click(object sender, EventArgs e) { if (IsPageValid()) { try { int opid = Convert.ToInt32(Request["OfferPriceId"].ToString()); OfferPriceInfo pc = new OfferPriceInfo(opid); if (pc.IsNewCreate == 1) { pc.IsMain = 0; pc.IsMain1 = 0; pc.IsMain2 = 0; pc.IsMain3 = 0; OfferPriceInfo pcnew = new OfferPriceInfo(); pcnew.IsMain = 1; pcnew.IsMain1 = 1; pcnew.IsMain2 = 1; pcnew.IsMain3 = 1; pcnew.IsNewCreate = 0; pcnew.MainOfferPriceId = pc.MainOfferPriceId; pcnew.SendEmployeeId = pc.SendEmployeeId; pcnew.SendEmployeeName = pc.SendEmployeeName; pcnew.PreIsApply = 1; pcnew.PreIsOver = 1; pcnew.IsApply = 0; pcnew.IsApprove = 0; pcnew.IsApply1 = 0; pcnew.IsApply2 = 0; pcnew.IsOver1 = 0; pcnew.IsOver2 = 0; pcnew.IsSignName = 0; if (ddlProject.SelectedValue != "") { pcnew.MainProjectCreateId = Convert.ToInt32(ddlProject.SelectedValue); } if (ddlEmployee.SelectedValue != "") { pcnew.EmployeeId = Convert.ToInt32(ddlEmployee.SelectedValue); } DateTime date = DateTime.Now; string strtoday = DateTime.Now.ToString("yyyyMMdd").Substring(2); pcnew.Today = strtoday; 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); if (pcnew.OfferFileId.ToString() == "") { OfferFileInfo of = new OfferFileInfo(); of.OfferFileName = fileName; of.PhyFileName = UpFile.PostedFile.FileName;//��ȡ�����ļ�·�� of.Save(); pcnew.OfferFileId = Convert.ToInt32(of.OfferFileId); } else { OfferFileInfo of = new OfferFileInfo(Convert.ToInt32(pcnew.OfferFileId)); of.OfferFileName = fileName;//�ļ����� of.PhyFileName = UpFile.PostedFile.FileName;//��ȡ�����ļ�·�� of.Save(); pcnew.OfferFileId = Convert.ToInt32(of.OfferFileId); } lblUrl.Text = UpFile.PostedFile.FileName;//�����ļ�·�� } if (UpFile.HasFile) { this.UpFile.PostedFile.SaveAs(Server.MapPath("~/Files/OfferPrice/" + UpFile.FileName)); } pcnew.OfferPriceTypeId = Convert.ToInt32(rblType.SelectedValue); pcnew.FillTableDate = Convert.ToDateTime(txtFillTableDate.Text.ToString()); pcnew.SectionView = txtSectionView.Text.ToString(); pcnew.SheetNum = txtSheetNum.Text.ToString(); pcnew.ProjectDes = txtProjectDes.Text.ToString(); pcnew.MoneySum = txtMoneySum.Text.ToString(); pcnew.BigMoney = txtBigMoney.Text.ToString(); pcnew.ProductMoneySum = lblMoneySum.Text.ToString(); pcnew.Save(); pc.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('�����ɹ���');</script>"); } else { if (ddlProject.SelectedValue != "") { pc.MainProjectCreateId = Convert.ToInt32(ddlProject.SelectedValue); } if (ddlEmployee.SelectedValue != "") { pc.EmployeeId = Convert.ToInt32(ddlEmployee.SelectedValue); } 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); if (pc.OfferFileId.ToString() == "") { OfferFileInfo of = new OfferFileInfo(); of.OfferFileName = fileName; of.PhyFileName = UpFile.PostedFile.FileName;//�����ļ�·�� of.Save(); pc.OfferFileId = Convert.ToInt32(of.OfferFileId); } else { OfferFileInfo of = new OfferFileInfo(Convert.ToInt32(pc.OfferFileId)); of.OfferFileName = fileName;//�ļ����� of.PhyFileName = UpFile.PostedFile.FileName;//�����ļ�·�� of.Save(); pc.OfferFileId = Convert.ToInt32(of.OfferFileId); } lblUrl.Text = UpFile.PostedFile.FileName; } 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)); } pc.FillTableDate = Convert.ToDateTime(txtFillTableDate.Text.ToString()); pc.SectionView = txtSectionView.Text.ToString(); pc.SheetNum = txtSheetNum.Text.ToString(); pc.ProjectDes = txtProjectDes.Text.ToString(); pc.OfferPriceTypeId = Convert.ToInt32(rblType.SelectedValue); pc.MoneySum = txtMoneySum.Text.ToString(); pc.BigMoney = txtBigMoney.Text.ToString(); pc.ProductMoneySum = lblMoneySum.Text.ToString(); pc.Save(); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language='javascript'>alert('�༭�ɹ���');</script>"); } } catch (Exception Ex) { ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('���ʧ�ܣ�" + Ex.Message + "');", true); } } }
//从后台获取数据 internal static void LoadFromDAL(OfferPriceInfo pOfferPriceInfo, OfferPrice pOfferPrice) { pOfferPriceInfo.offerPriceId = pOfferPrice.OfferPriceId; pOfferPriceInfo.employeeId = pOfferPrice.EmployeeId; pOfferPriceInfo.mainProjectCreateId = pOfferPrice.MainProjectCreateId; pOfferPriceInfo.mainOfferPriceId = pOfferPrice.MainOfferPriceId; pOfferPriceInfo.projectDes = pOfferPrice.ProjectDes; pOfferPriceInfo.sheetNum = pOfferPrice.SheetNum; pOfferPriceInfo.fillTableDate = pOfferPrice.FillTableDate; pOfferPriceInfo.finaceView = pOfferPrice.FinaceView; pOfferPriceInfo.sectionView = pOfferPrice.SectionView; pOfferPriceInfo.mangerView = pOfferPrice.MangerView; pOfferPriceInfo.isApply = pOfferPrice.IsApply; pOfferPriceInfo.isApply1 = pOfferPrice.IsApply1; pOfferPriceInfo.isApply2 = pOfferPrice.IsApply2; pOfferPriceInfo.isOver1 = pOfferPrice.IsOver1; pOfferPriceInfo.isOver2 = pOfferPrice.IsOver2; pOfferPriceInfo.applyTime = pOfferPrice.ApplyTime; pOfferPriceInfo.apply1Time = pOfferPrice.Apply1Time; pOfferPriceInfo.apply2Time = pOfferPrice.Apply2Time; pOfferPriceInfo.sendEmployeeId = pOfferPrice.SendEmployeeId; pOfferPriceInfo.recv1EmployeeId = pOfferPrice.Recv1EmployeeId; pOfferPriceInfo.recv2EmployeeId = pOfferPrice.Recv2EmployeeId; pOfferPriceInfo.sendEmployeeName = pOfferPrice.SendEmployeeName; pOfferPriceInfo.recv1EmployeeName = pOfferPrice.Recv1EmployeeName; pOfferPriceInfo.recv2EmployeeName = pOfferPrice.Recv2EmployeeName; pOfferPriceInfo.preEmployeeId = pOfferPrice.PreEmployeeId; pOfferPriceInfo.preEmployeeName = pOfferPrice.PreEmployeeName; pOfferPriceInfo.preIsApply = pOfferPrice.PreIsApply; pOfferPriceInfo.preIsOver = pOfferPrice.PreIsOver; pOfferPriceInfo.preApplyTime = pOfferPrice.PreApplyTime; pOfferPriceInfo.recvEmployeeId = pOfferPrice.RecvEmployeeId; pOfferPriceInfo.isMain = pOfferPrice.IsMain; pOfferPriceInfo.isMain1 = pOfferPrice.IsMain1; pOfferPriceInfo.isMain2 = pOfferPrice.IsMain2; pOfferPriceInfo.isMain3 = pOfferPrice.IsMain3; pOfferPriceInfo.isNewCreate = pOfferPrice.IsNewCreate; pOfferPriceInfo.isApprove = pOfferPrice.IsApprove; pOfferPriceInfo.approveTime = pOfferPrice.ApproveTime; pOfferPriceInfo.today = pOfferPrice.Today; pOfferPriceInfo.offerPriceTypeId = pOfferPrice.OfferPriceTypeId; pOfferPriceInfo.offerFileId = pOfferPrice.OfferFileId; pOfferPriceInfo.moneySum = pOfferPrice.MoneySum; pOfferPriceInfo.bigMoney = pOfferPrice.BigMoney; pOfferPriceInfo.productMoneySum = pOfferPrice.ProductMoneySum; pOfferPriceInfo.isSignName = pOfferPrice.IsSignName; pOfferPriceInfo.Loaded=true; }
/// <summary> /// 复制为另一个对象 /// </summary> /// <param name="pIndustryTypeInfoTo"></param> public void CopyTo(OfferPriceInfo pOfferPriceInfoTo) { Copy(this, pOfferPriceInfoTo); }
protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e) { //Check if this is our Blank Row being databound, if so make the row invisible if (e.Row.RowType == DataControlRowType.DataRow) { if (((DataRowView)e.Row.DataItem)["OfferPriceId"].ToString() == String.Empty) e.Row.Visible = false; } 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 (e.Row.RowType == DataControlRowType.DataRow) { Label lblState = e.Row.FindControl("lblState") as Label; GridView gvTemp = (GridView)sender; if (!Convert.IsDBNull(gvTemp.DataKeys[e.Row.RowIndex].Value)) { int SaleId = Convert.ToInt32(gvTemp.DataKeys[e.Row.RowIndex].Value); OfferPriceInfo pc = new OfferPriceInfo(SaleId); Label lblApplyName = e.Row.FindControl("lblApplyName") as Label; Label lblApplyTime = e.Row.FindControl("lblApplyTime") as Label; if (pc.SendEmployeeName == "") { lblApplyName.Text = pc.PreEmployeeName.ToString();//�г���Ա�� lblApplyTime.Text = pc.PreApplyTime.ToString(); } else if (pc.PreEmployeeName == "") { lblApplyName.Text = pc.SendEmployeeName.ToString();//�г������� lblApplyTime.Text = pc.ApplyTime.ToString(); } //����״̬ if (pc.IsApply2 == 0) { lblState.Text = "����"; } else if (pc.IsApply2 == 1) { if (pc.IsOver2 == 0) { lblState.Text = "����"; } else { lblState.Text = "ͨ��"; } } } } }
/// <summary> /// 复制一个对象,采用硬编码的方式,避免反射的低效 /// </summary> /// <param name="pIndustryTypeInfoFrom"></param> /// <param name="pIndustryTypeInfoTo"></param> public static void Copy(OfferPriceInfo pOfferPriceInfoFrom, OfferPriceInfo pOfferPriceInfoTo) { pOfferPriceInfoTo.OfferPriceId = pOfferPriceInfoFrom.offerPriceId; pOfferPriceInfoTo.EmployeeId = pOfferPriceInfoFrom.employeeId; pOfferPriceInfoTo.MainProjectCreateId = pOfferPriceInfoFrom.mainProjectCreateId; pOfferPriceInfoTo.MainOfferPriceId = pOfferPriceInfoFrom.mainOfferPriceId; pOfferPriceInfoTo.ProjectDes = pOfferPriceInfoFrom.projectDes; pOfferPriceInfoTo.SheetNum = pOfferPriceInfoFrom.sheetNum; pOfferPriceInfoTo.FillTableDate = pOfferPriceInfoFrom.fillTableDate; pOfferPriceInfoTo.FinaceView = pOfferPriceInfoFrom.finaceView; pOfferPriceInfoTo.SectionView = pOfferPriceInfoFrom.sectionView; pOfferPriceInfoTo.MangerView = pOfferPriceInfoFrom.mangerView; pOfferPriceInfoTo.IsApply = pOfferPriceInfoFrom.isApply; pOfferPriceInfoTo.IsApply1 = pOfferPriceInfoFrom.isApply1; pOfferPriceInfoTo.IsApply2 = pOfferPriceInfoFrom.isApply2; pOfferPriceInfoTo.IsOver1 = pOfferPriceInfoFrom.isOver1; pOfferPriceInfoTo.IsOver2 = pOfferPriceInfoFrom.isOver2; pOfferPriceInfoTo.ApplyTime = pOfferPriceInfoFrom.applyTime; pOfferPriceInfoTo.Apply1Time = pOfferPriceInfoFrom.apply1Time; pOfferPriceInfoTo.Apply2Time = pOfferPriceInfoFrom.apply2Time; pOfferPriceInfoTo.SendEmployeeId = pOfferPriceInfoFrom.sendEmployeeId; pOfferPriceInfoTo.Recv1EmployeeId = pOfferPriceInfoFrom.recv1EmployeeId; pOfferPriceInfoTo.Recv2EmployeeId = pOfferPriceInfoFrom.recv2EmployeeId; pOfferPriceInfoTo.SendEmployeeName = pOfferPriceInfoFrom.sendEmployeeName; pOfferPriceInfoTo.Recv1EmployeeName = pOfferPriceInfoFrom.recv1EmployeeName; pOfferPriceInfoTo.Recv2EmployeeName = pOfferPriceInfoFrom.recv2EmployeeName; pOfferPriceInfoTo.PreEmployeeId = pOfferPriceInfoFrom.preEmployeeId; pOfferPriceInfoTo.PreEmployeeName = pOfferPriceInfoFrom.preEmployeeName; pOfferPriceInfoTo.PreIsApply = pOfferPriceInfoFrom.preIsApply; pOfferPriceInfoTo.PreIsOver = pOfferPriceInfoFrom.preIsOver; pOfferPriceInfoTo.PreApplyTime = pOfferPriceInfoFrom.preApplyTime; pOfferPriceInfoTo.RecvEmployeeId = pOfferPriceInfoFrom.recvEmployeeId; pOfferPriceInfoTo.IsMain = pOfferPriceInfoFrom.isMain; pOfferPriceInfoTo.IsMain1 = pOfferPriceInfoFrom.isMain1; pOfferPriceInfoTo.IsMain2 = pOfferPriceInfoFrom.isMain2; pOfferPriceInfoTo.IsMain3 = pOfferPriceInfoFrom.isMain3; pOfferPriceInfoTo.IsNewCreate = pOfferPriceInfoFrom.isNewCreate; pOfferPriceInfoTo.IsApprove = pOfferPriceInfoFrom.isApprove; pOfferPriceInfoTo.ApproveTime = pOfferPriceInfoFrom.approveTime; pOfferPriceInfoTo.Today = pOfferPriceInfoFrom.today; pOfferPriceInfoTo.OfferPriceTypeId = pOfferPriceInfoFrom.offerPriceTypeId; pOfferPriceInfoTo.OfferFileId = pOfferPriceInfoFrom.offerFileId; pOfferPriceInfoTo.MoneySum = pOfferPriceInfoFrom.moneySum; pOfferPriceInfoTo.BigMoney = pOfferPriceInfoFrom.bigMoney; pOfferPriceInfoTo.ProductMoneySum = pOfferPriceInfoFrom.productMoneySum; pOfferPriceInfoTo.IsSignName = pOfferPriceInfoFrom.isSignName; pOfferPriceInfoTo.Loaded=pOfferPriceInfoFrom.Loaded; }
//数据持久化 internal static void SaveToDb(OfferPriceInfo pOfferPriceInfo, OfferPrice pOfferPrice,bool pIsNew) { pOfferPrice.OfferPriceId = pOfferPriceInfo.offerPriceId; pOfferPrice.EmployeeId = pOfferPriceInfo.employeeId; pOfferPrice.MainProjectCreateId = pOfferPriceInfo.mainProjectCreateId; pOfferPrice.MainOfferPriceId = pOfferPriceInfo.mainOfferPriceId; pOfferPrice.ProjectDes = pOfferPriceInfo.projectDes; pOfferPrice.SheetNum = pOfferPriceInfo.sheetNum; pOfferPrice.FillTableDate = pOfferPriceInfo.fillTableDate; pOfferPrice.FinaceView = pOfferPriceInfo.finaceView; pOfferPrice.SectionView = pOfferPriceInfo.sectionView; pOfferPrice.MangerView = pOfferPriceInfo.mangerView; pOfferPrice.IsApply = pOfferPriceInfo.isApply; pOfferPrice.IsApply1 = pOfferPriceInfo.isApply1; pOfferPrice.IsApply2 = pOfferPriceInfo.isApply2; pOfferPrice.IsOver1 = pOfferPriceInfo.isOver1; pOfferPrice.IsOver2 = pOfferPriceInfo.isOver2; pOfferPrice.ApplyTime = pOfferPriceInfo.applyTime; pOfferPrice.Apply1Time = pOfferPriceInfo.apply1Time; pOfferPrice.Apply2Time = pOfferPriceInfo.apply2Time; pOfferPrice.SendEmployeeId = pOfferPriceInfo.sendEmployeeId; pOfferPrice.Recv1EmployeeId = pOfferPriceInfo.recv1EmployeeId; pOfferPrice.Recv2EmployeeId = pOfferPriceInfo.recv2EmployeeId; pOfferPrice.SendEmployeeName = pOfferPriceInfo.sendEmployeeName; pOfferPrice.Recv1EmployeeName = pOfferPriceInfo.recv1EmployeeName; pOfferPrice.Recv2EmployeeName = pOfferPriceInfo.recv2EmployeeName; pOfferPrice.PreEmployeeId = pOfferPriceInfo.preEmployeeId; pOfferPrice.PreEmployeeName = pOfferPriceInfo.preEmployeeName; pOfferPrice.PreIsApply = pOfferPriceInfo.preIsApply; pOfferPrice.PreIsOver = pOfferPriceInfo.preIsOver; pOfferPrice.PreApplyTime = pOfferPriceInfo.preApplyTime; pOfferPrice.RecvEmployeeId = pOfferPriceInfo.recvEmployeeId; pOfferPrice.IsMain = pOfferPriceInfo.isMain; pOfferPrice.IsMain1 = pOfferPriceInfo.isMain1; pOfferPrice.IsMain2 = pOfferPriceInfo.isMain2; pOfferPrice.IsMain3 = pOfferPriceInfo.isMain3; pOfferPrice.IsNewCreate = pOfferPriceInfo.isNewCreate; pOfferPrice.IsApprove = pOfferPriceInfo.isApprove; pOfferPrice.ApproveTime = pOfferPriceInfo.approveTime; pOfferPrice.Today = pOfferPriceInfo.today; pOfferPrice.OfferPriceTypeId = pOfferPriceInfo.offerPriceTypeId; pOfferPrice.OfferFileId = pOfferPriceInfo.offerFileId; pOfferPrice.MoneySum = pOfferPriceInfo.moneySum; pOfferPrice.BigMoney = pOfferPriceInfo.bigMoney; pOfferPrice.ProductMoneySum = pOfferPriceInfo.productMoneySum; pOfferPrice.IsSignName = pOfferPriceInfo.isSignName; pOfferPrice.IsNew=pIsNew; string UserName = SubsonicHelper.GetUserName(); try { pOfferPrice.Save(UserName); } catch(Exception ex) { LogManager.getInstance().getLogger(typeof(OfferPriceInfo)).Error(ex); if(ex.Message.Contains("插入重复键"))//违反了唯一键 { throw new AppException("此对象已经存在");//此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示 } throw new AppException("保存失败"); } pOfferPriceInfo.offerPriceId = pOfferPrice.OfferPriceId; //如果缓存存在,更新缓存 if (CachedEntityCommander.IsTypeRegistered(typeof(OfferPriceInfo))) { ResetCache(); } }
protected void gvPrice_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Label lblState = e.Row.FindControl("lblState") as Label; Button btnSubmit = e.Row.FindControl("btnSubmit") as Button; Button btnEdit = e.Row.FindControl("btnEdit") as Button; if (!Convert.IsDBNull(gvPrice.DataKeys[e.Row.RowIndex].Value)) { //����GridView GridView gv = e.Row.FindControl("GridView2") as GridView; int emid = Convert.ToInt32(Session["EmployeeId"]); int SaleId = Convert.ToInt32(gvPrice.DataKeys[e.Row.RowIndex].Value); OfferPriceInfo pc = new OfferPriceInfo(SaleId); int mainid = Convert.ToInt32(pc.MainOfferPriceId); DataTable dt = OfferPriceInfo.getPreOfferPriceListOfEmployee2(emid, mainid); if (dt.Rows.Count == 0) { dt.Rows.Add(dt.NewRow()); UI.BindCtrl(dt.DefaultView, gv, AspNetPager1); gv.Rows[0].Visible = false; } else { UI.BindCtrl(dt.DefaultView, gv, AspNetPager1); } //button���� if (pc.PreIsApply == 1) { btnSubmit.Enabled = false; if (pc.IsNewCreate == 1)//����δͨ���������� { btnEdit.Enabled = true; } else//Ĭ��IsNewCreate==0�������룬�༭��ť�����á� { btnEdit.Enabled = false; } } if (pc.IsApprove == 0) { lblState.Text = "�г���:���� �ܾ���:����"; } else if (pc.IsApprove == 1 && pc.IsApply2 == 0) { if (pc.PreIsOver == 1) { lblState.Text = "�г���:ͨ�� �ܾ���:����"; } else { lblState.Text = "�г���:����"; } } else if (pc.IsApply2 == 1) { if (pc.IsOver2 == 1) { lblState.Text = "�г���:ͨ�� �ܾ���:ͨ��"; } else { lblState.Text = "�г���:ͨ�� �ܾ���:����"; } } } 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"; } } }
/// <summary> /// 批量装载 /// </summary> internal static void LoadFromDALPatch(List< OfferPriceInfo> pList, OfferPriceCollection pCollection) { foreach (OfferPrice offerPrice in pCollection) { OfferPriceInfo offerPriceInfo = new OfferPriceInfo(); LoadFromDAL(offerPriceInfo, offerPrice ); pList.Add(offerPriceInfo); } }
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); } } }
public void DeleteById(OfferPriceInfo pOfferPriceInfo) { OfferPriceInfo offerPriceInfo = new OfferPriceInfo(pOfferPriceInfo.OfferPriceId); offerPriceInfo.Delete(); }
protected void PageInit() { txtManagerView.ReadOnly = true; int opid = Convert.ToInt32(Request["OfferPriceId"].ToString()); OfferPriceInfo op = new OfferPriceInfo(opid); ddlProject.SelectedValue = op.MainProjectCreateId.ToString(); ddlEmployee.SelectedValue = op.EmployeeId.ToString(); txtFillTableDate.Text = op.FillTableDate.ToString(); txtManagerView.Text = op.MangerView.ToString(); txtSectionView.Text = op.SectionView.ToString(); txtSheetNum.Text = op.SheetNum.ToString(); txtProjectDes.Text = op.ProjectDes.ToString(); rblType.SelectedValue = op.OfferPriceTypeId.ToString(); lblMoneySum.Text = op.ProductMoneySum.ToString(); if (op.MoneySum != null) { txtMoneySum.Text = op.MoneySum.ToString(); } if (op.BigMoney != null) { txtBigMoney.Text = op.BigMoney.ToString(); } MainProjectCreateInfo project = new MainProjectCreateInfo(Convert.ToInt32(op.MainProjectCreateId)); lblProjectNum.Text = project.SheetNum.ToString(); if (op.OfferFileId != null) { OfferFileInfo of = new OfferFileInfo(Convert.ToInt32(op.OfferFileId)); lblUrl.Text = of.PhyFileName.ToString(); } }
//数据持久化 internal static void SaveToDb(OfferPriceInfo pOfferPriceInfo, OfferPrice pOfferPrice, bool pIsNew) { pOfferPrice.OfferPriceId = pOfferPriceInfo.offerPriceId; pOfferPrice.EmployeeId = pOfferPriceInfo.employeeId; pOfferPrice.MainProjectCreateId = pOfferPriceInfo.mainProjectCreateId; pOfferPrice.MainOfferPriceId = pOfferPriceInfo.mainOfferPriceId; pOfferPrice.ProjectDes = pOfferPriceInfo.projectDes; pOfferPrice.SheetNum = pOfferPriceInfo.sheetNum; pOfferPrice.FillTableDate = pOfferPriceInfo.fillTableDate; pOfferPrice.FinaceView = pOfferPriceInfo.finaceView; pOfferPrice.SectionView = pOfferPriceInfo.sectionView; pOfferPrice.MangerView = pOfferPriceInfo.mangerView; pOfferPrice.IsApply = pOfferPriceInfo.isApply; pOfferPrice.IsApply1 = pOfferPriceInfo.isApply1; pOfferPrice.IsApply2 = pOfferPriceInfo.isApply2; pOfferPrice.IsOver1 = pOfferPriceInfo.isOver1; pOfferPrice.IsOver2 = pOfferPriceInfo.isOver2; pOfferPrice.ApplyTime = pOfferPriceInfo.applyTime; pOfferPrice.Apply1Time = pOfferPriceInfo.apply1Time; pOfferPrice.Apply2Time = pOfferPriceInfo.apply2Time; pOfferPrice.SendEmployeeId = pOfferPriceInfo.sendEmployeeId; pOfferPrice.Recv1EmployeeId = pOfferPriceInfo.recv1EmployeeId; pOfferPrice.Recv2EmployeeId = pOfferPriceInfo.recv2EmployeeId; pOfferPrice.SendEmployeeName = pOfferPriceInfo.sendEmployeeName; pOfferPrice.Recv1EmployeeName = pOfferPriceInfo.recv1EmployeeName; pOfferPrice.Recv2EmployeeName = pOfferPriceInfo.recv2EmployeeName; pOfferPrice.PreEmployeeId = pOfferPriceInfo.preEmployeeId; pOfferPrice.PreEmployeeName = pOfferPriceInfo.preEmployeeName; pOfferPrice.PreIsApply = pOfferPriceInfo.preIsApply; pOfferPrice.PreIsOver = pOfferPriceInfo.preIsOver; pOfferPrice.PreApplyTime = pOfferPriceInfo.preApplyTime; pOfferPrice.RecvEmployeeId = pOfferPriceInfo.recvEmployeeId; pOfferPrice.IsMain = pOfferPriceInfo.isMain; pOfferPrice.IsMain1 = pOfferPriceInfo.isMain1; pOfferPrice.IsMain2 = pOfferPriceInfo.isMain2; pOfferPrice.IsMain3 = pOfferPriceInfo.isMain3; pOfferPrice.IsNewCreate = pOfferPriceInfo.isNewCreate; pOfferPrice.IsApprove = pOfferPriceInfo.isApprove; pOfferPrice.ApproveTime = pOfferPriceInfo.approveTime; pOfferPrice.Today = pOfferPriceInfo.today; pOfferPrice.OfferPriceTypeId = pOfferPriceInfo.offerPriceTypeId; pOfferPrice.OfferFileId = pOfferPriceInfo.offerFileId; pOfferPrice.MoneySum = pOfferPriceInfo.moneySum; pOfferPrice.BigMoney = pOfferPriceInfo.bigMoney; pOfferPrice.ProductMoneySum = pOfferPriceInfo.productMoneySum; pOfferPrice.IsSignName = pOfferPriceInfo.isSignName; pOfferPrice.IsNew = pIsNew; string UserName = SubsonicHelper.GetUserName(); try { pOfferPrice.Save(UserName); } catch (Exception ex) { LogManager.getInstance().getLogger(typeof(OfferPriceInfo)).Error(ex); if (ex.Message.Contains("插入重复键")) //违反了唯一键 { throw new AppException("此对象已经存在"); //此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示 } throw new AppException("保存失败"); } pOfferPriceInfo.offerPriceId = pOfferPrice.OfferPriceId; //如果缓存存在,更新缓存 if (CachedEntityCommander.IsTypeRegistered(typeof(OfferPriceInfo))) { ResetCache(); } }
/// <summary> /// 获得数据列表 /// </summary> /// <returns></returns> public static List<OfferPriceInfo> GetList() { string cacheKey = GetCacheKey(); //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取 if (CachedEntityCommander.IsTypeRegistered(typeof(OfferPriceInfo)) && CachedEntityCommander.GetCache(cacheKey) != null) { return CachedEntityCommander.GetCache(cacheKey) as List< OfferPriceInfo>; } else { List< OfferPriceInfo> list =new List< OfferPriceInfo>(); OfferPriceCollection collection=new OfferPriceCollection(); Query qry = new Query(OfferPrice.Schema); collection.LoadAndCloseReader(qry.ExecuteReader()); foreach(OfferPrice offerPrice in collection) { OfferPriceInfo offerPriceInfo= new OfferPriceInfo(); LoadFromDAL(offerPriceInfo,offerPrice); list.Add(offerPriceInfo); } //生成缓存 if (CachedEntityCommander.IsTypeRegistered(typeof(OfferPriceInfo))) { CachedEntityCommander.SetCache(cacheKey, list); } return list; } }
public void DeleteById(OfferPriceInfo pOfferPriceInfo) { OfferPriceInfo offerPriceInfo = new OfferPriceInfo(pOfferPriceInfo.OfferPriceId); offerPriceInfo.Delete(); }
protected void gvPrice_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"; //�����ˡ�����ʱ�� Label lblState = e.Row.FindControl("lblState") as Label; Button btnSubmit = e.Row.FindControl("btnSubmit") as Button; Label lblApplyName = e.Row.FindControl("lblApplyName") as Label; Label lblApplyTime = e.Row.FindControl("lblApplyTime") as Label; if (!Convert.IsDBNull(gvPrice.DataKeys[e.Row.RowIndex].Value)) { int SaleId = Convert.ToInt32(gvPrice.DataKeys[e.Row.RowIndex].Value); OfferPriceInfo pc = new OfferPriceInfo(SaleId); if (pc.SendEmployeeName == "") { lblApplyName.Text = pc.PreEmployeeName.ToString();//�г���Ա�� lblApplyTime.Text = pc.PreApplyTime.ToString(); } else if (pc.PreEmployeeName == "") { lblApplyName.Text = pc.SendEmployeeName.ToString();//�г������� lblApplyTime.Text = pc.ApplyTime.ToString(); } int emid = Convert.ToInt32(Session["EmployeeId"]); //����GridView GridView gv = e.Row.FindControl("GridView2") as GridView; int mainid = Convert.ToInt32(pc.MainOfferPriceId); DataTable dt = OfferPriceInfo.getOfferPriceListOfApproves2(emid, mainid); if (dt.Rows.Count == 0) { dt.Rows.Add(dt.NewRow()); UI.BindCtrl(dt.DefaultView, gv, AspNetPager2); gv.Rows[0].Visible = false; } else { UI.BindCtrl(dt.DefaultView, gv, AspNetPager2); } //button���� if (pc.IsApply2 == 1) { btnSubmit.Enabled = false; } //����״̬ if (pc.IsApply2 == 0) { lblState.Text = "����"; } else if (pc.IsApply2 == 1) { if (pc.IsOver2 == 0) { lblState.Text = "����"; } else { lblState.Text = "ͨ��"; } } } } }
/// <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<OfferPriceInfo> GetPagedList(int pPageIndex,int pPageSize,SortDirection pOrderBy,string pSortExpression,out int pRecordCount) { if(pPageIndex<=1) pPageIndex=1; List< OfferPriceInfo> list = new List< OfferPriceInfo>(); Query q = OfferPrice .CreateQuery(); q.PageIndex = pPageIndex; q.PageSize = pPageSize; q.ORDER_BY(pSortExpression,pOrderBy.ToString()); OfferPriceCollection collection=new OfferPriceCollection(); collection.LoadAndCloseReader(q.ExecuteReader()); foreach (OfferPrice offerPrice in collection) { OfferPriceInfo offerPriceInfo = new OfferPriceInfo(); LoadFromDAL(offerPriceInfo, offerPrice); list.Add(offerPriceInfo); } pRecordCount=q.GetRecordCount(); return list; }