Esempio n. 1
0
        protected void PageInit()
        {
            int ClientId = Convert.ToInt32(Request["ClientId"].ToString());
            ClientInfo client = new ClientInfo(ClientId);
            lblAddress.Text = client.Address.ToString();

            lblClientName.Text = client.ClientName.ToString();
            lblClientNum.Text = client.SheetNum.ToString();
            lblFax.Text = client.Fax.ToString();
            lblMailNo.Text = client.MailNo.ToString();
            lblTelephone.Text = client.Telephone.ToString();
            int clientlevelid = Convert.ToInt32(client.ClientLevelId);
            ClientLevelInfo clientlevel = new ClientLevelInfo(clientlevelid);
            lblClientLevel.Text = clientlevel.ClientLevelName.ToString();
        }
Esempio n. 2
0
        public ClientInfo GetClientInfoById(int ClientId)
        {
            ClientInfo clientInfo  = null;//
            try
            {
                 clientInfo = new ClientInfo(ClientId);

            }
            catch (AppException)
            {
                return null;
            }

            return  clientInfo;
        }
Esempio n. 3
0
 protected void ddlClient_SelectedIndexChanged(object sender, EventArgs e)
 {
     int ClientId = Convert.ToInt32(ddlClient.SelectedValue);
     ClientInfo client = new ClientInfo(ClientId);
     string sheetnum = client.SheetNum.ToString();
     string strtoday = DateTime.Now.ToString("yyyyMMdd").Substring(2);
     if (SheetNums.IsSheetNumOfProject())
     {
         lblProjectNum.Text = SheetNums.SheetNumOfProject("XM", sheetnum, strtoday);
     }
     else
     {
         lblProjectNum.Text = "XM" + sheetnum + strtoday + "001";
     }
 }
Esempio n. 4
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (IsPageValid())
            {
                try
                {

                    ClientInfo client = new ClientInfo();
                    client.Address = txtAddress.Text.ToString();
                    client.ClientName = txtClientName.Text.ToString();
                    client.MailNo = txtMailNo.Text.ToString();
                    client.Fax = txtFax.Text.ToString();
                    client.Telephone = txtTelephone.Text.ToString();
                    if (ddlClientLevel.SelectedValue != "")
                    {
                        client.ClientLevelId = Convert.ToInt32(ddlClientLevel.SelectedValue);
                    }

                    client.ClientTypeId = Convert.ToInt32(ddlClientType.SelectedValue);
                    client.SheetNum = txtClientNum.Text.ToString();
                    client.Save();
                    RelateInfo relate = new RelateInfo();
                    relate.ClientId = client.ClientId;
                    relate.Position = txtPosition.Text.ToString();
                    relate.Email = txtEmail.Text.ToString();
                    relate.Memo = txtMemo.Text.ToString();
                    relate.Mobile = txtMobile.Text.ToString();
                    relate.RelateName = txtRelateName.Text.ToString();
                    relate.Save();

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

                   // ClearForms();
                }
                catch (Exception Ex)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('����ʧ�ܣ�" + Ex.Message + "');", true);
                }

            }
        }
Esempio n. 5
0
 protected void ddlAuto_SelectedIndexChanged(object sender, EventArgs e)
 {
     string strtoday = DateTime.Now.ToString("yyyyMMdd").Substring(2);
     if (ddlContractType.SelectedItem.Text == "���ۺ�ͬ")
     {
         ClientInfo client = new ClientInfo(Convert.ToInt32(ddlAuto.SelectedValue));
         if (SheetNums.IsNumOfContract(client.ClientName.ToString()))
         {
             txtContractNum.Text = SheetNums.NumOfContract("XS", client.SheetNum.ToString(), strtoday, client.ClientName.ToString());
         }
         else
         {
             txtContractNum.Text = "XS" + client.SheetNum.ToString() + strtoday + "001";
         }
     }
     else if (ddlContractType.SelectedItem.Text == "�ɹ���ͬ")
     {
         SupplyInfo supply = new SupplyInfo(Convert.ToInt32(ddlAuto.SelectedValue));
         if (SheetNums.IsNumOfContract(supply.SheetNum.ToString()))
         {
             txtContractNum.Text = SheetNums.NumOfContract("CG", supply.SheetNum.ToString(), strtoday, supply.SheetNum.ToString());
         }
         else
         {
             txtContractNum.Text = "CG" + supply.SheetNum.ToString() + strtoday + "001";
         }
     }
     else if (ddlContractType.SelectedItem.Text == "��")
     {
         SupplyInfo supply = new SupplyInfo(Convert.ToInt32(ddlAuto.SelectedValue));
         string sheetnum = supply.SheetNum.ToString();
         if (SheetNums.IsNumOfContract(supply.SheetNum.ToString()))
         {
             txtContractNum.Text = SheetNums.NumOfContract("XY", sheetnum, strtoday, supply.SheetNum.ToString());
         }
         else
         {
             txtContractNum.Text = "XY" + supply.SheetNum.ToString() + strtoday + "001";
         }
     }
 }
Esempio n. 6
0
        private void PageBind()
        {
            int pid = Convert.ToInt32(Request["ProjectCreateId"].ToString());
            ProjectCreateInfo pc = new ProjectCreateInfo(pid);

            ClientInfo client = new ClientInfo(Convert.ToInt32(pc.ClientId));
            ProjectTypeInfo type = new ProjectTypeInfo(Convert.ToInt32(pc.ProjectTypeId));
            ProjectLevelInfo level = new ProjectLevelInfo(Convert.ToInt32(pc.ProjectLevelId));
            YeWuInfo yw = new YeWuInfo(Convert.ToInt32(pc.YeWuId));
            lblClientName.Text = client.ClientName.ToString();
            lblProjectType.Text = type.ProjectTypeName.ToString();
            lblProjectLevel.Text = level.ProjectLevelName.ToString();
            lblYewu.Text = yw.YeWuName.ToString();

            lblSheetNums.Text = pc.SheetNum.ToString();
            lblProjectFullName.Text = pc.ProjectName.ToString();
            lblProjectNum.Text = pc.SheetNum.ToString();
            lblPredictMoney.Text = pc.PreMoney.ToString();
            lblPredictProfit.Text = pc.PreProfit.ToString();
            lblApplyDate.Text = pc.ApplyDate.ToString();
            lblApplyName.Text = pc.ApplyName.ToString();
            lblApplyDepart.Text = pc.DepartName.ToString();
            txtBusinessDes.Text = pc.BusinessDescribe.ToString();
            lblCallBidPhaseExp.Text = pc.CallbidPhaseExp.ToString();
            lblCarryPhaseExp.Text = pc.CarryPhaseExp.ToString();
            txtClientDes.Text = pc.ClientDescribe.ToString();
            txtCompitDes.Text = pc.CompitDescribe.ToString();
            lblCratePhaseExp.Text = pc.CreatePhaseExp.ToString();
            txtManagerView.Text = pc.ManagerView.ToString();
            txtMemo.Text = pc.Memo.ToString();
            txtNeedDes.Text = pc.NeedDescribe.ToString();
            lblProjectFullName.Text =pc.ProjectName;
            lblProposePhaseExp.Text = pc.ProposePhaseExp.ToString();
            txtRiskDes.Text = pc.RiskDescribe.ToString();
            txtStrategyDes.Text = pc.StrategyDesribe.ToString();
            lblTalkPhaseExp.Text = pc.TalkPhaseExp.ToString();
            txtTechDes.Text = pc.TechDescribe.ToString();
            txtTechView.Text = pc.TechView.ToString();
            txtMarketView.Text = pc.MarketView.ToString();
        }
Esempio n. 7
0
 public List <ClientInfo> GetClientInfoList()
 {
     return(ClientInfo.GetList());
 }
Esempio n. 8
0
        public void DeleteById(ClientInfo pClientInfo)
        {
            ClientInfo clientInfo = new ClientInfo(pClientInfo.ClientId);

            clientInfo.Delete();
        }
Esempio n. 9
0
 public object SaveClientInfo(ClientInfo clientInfo)
 {
     clientInfo.Save();
     return clientInfo . ClientId;
 }
Esempio n. 10
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 /// <returns></returns>
 public static List<ClientInfo> GetList()
 {
     string cacheKey = GetCacheKey();
     //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
     if (CachedEntityCommander.IsTypeRegistered(typeof(ClientInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
     {
         return CachedEntityCommander.GetCache(cacheKey) as List< ClientInfo>;
     }
     else
     {
         List< ClientInfo>  list =new List< ClientInfo>();
         ClientCollection  collection=new  ClientCollection();
         Query qry = new Query(Client.Schema);
         collection.LoadAndCloseReader(qry.ExecuteReader());
         foreach(Client client in collection)
         {
             ClientInfo clientInfo= new ClientInfo();
             LoadFromDAL(clientInfo,client);
             list.Add(clientInfo);
         }
       	//生成缓存
         if (CachedEntityCommander.IsTypeRegistered(typeof(ClientInfo)))
         {
             CachedEntityCommander.SetCache(cacheKey, list);
         }
         return list;
     }
 }
Esempio n. 11
0
 //数据持久化
 internal static void SaveToDb(ClientInfo pClientInfo, Client  pClient,bool pIsNew)
 {
     pClient.ClientId = pClientInfo.clientId;
      		pClient.ClientName = pClientInfo.clientName;
      		pClient.ClientLevelId = pClientInfo.clientLevelId;
      		pClient.Address = pClientInfo.address;
      		pClient.Telephone = pClientInfo.telephone;
      		pClient.MailNo = pClientInfo.mailNo;
      		pClient.Fax = pClientInfo.fax;
      		pClient.EmployeeId = pClientInfo.employeeId;
      		pClient.ClientTypeId = pClientInfo.clientTypeId;
      		pClient.SheetNum = pClientInfo.sheetNum;
     pClient.IsNew=pIsNew;
     string UserName = SubsonicHelper.GetUserName();
     try
     {
         pClient.Save(UserName);
     }
     catch(Exception ex)
     {
         LogManager.getInstance().getLogger(typeof(ClientInfo)).Error(ex);
         if(ex.Message.Contains("插入重复键"))//违反了唯一键
         {
             throw new AppException("此对象已经存在");//此处等待优化可以从唯一约束中直接取出提示来,如果没有的话,默认为原始的出错提示
         }
         throw new AppException("保存失败");
     }
     pClientInfo.clientId = pClient.ClientId;
     //如果缓存存在,更新缓存
     if (CachedEntityCommander.IsTypeRegistered(typeof(ClientInfo)))
     {
         ResetCache();
     }
 }
Esempio n. 12
0
 /// <summary>
 /// 批量装载
 /// </summary>
 internal static void LoadFromDALPatch(List< ClientInfo> pList, ClientCollection pCollection)
 {
     foreach (Client client in pCollection)
     {
         ClientInfo clientInfo = new ClientInfo();
         LoadFromDAL(clientInfo, client );
         pList.Add(clientInfo);
     }
 }
Esempio n. 13
0
 //从后台获取数据
 internal static void LoadFromDAL(ClientInfo pClientInfo, Client  pClient)
 {
     pClientInfo.clientId = pClient.ClientId;
      		pClientInfo.clientName = pClient.ClientName;
      		pClientInfo.clientLevelId = pClient.ClientLevelId;
      		pClientInfo.address = pClient.Address;
      		pClientInfo.telephone = pClient.Telephone;
      		pClientInfo.mailNo = pClient.MailNo;
      		pClientInfo.fax = pClient.Fax;
      		pClientInfo.employeeId = pClient.EmployeeId;
      		pClientInfo.clientTypeId = pClient.ClientTypeId;
      		pClientInfo.sheetNum = pClient.SheetNum;
     pClientInfo.Loaded=true;
 }
Esempio n. 14
0
 /// <summary>
 /// 复制为另一个对象
 /// </summary>
 /// <param name="pIndustryTypeInfoTo"></param>
 public void CopyTo(ClientInfo pClientInfoTo)
 {
     Copy(this,  pClientInfoTo);
 }
Esempio n. 15
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<ClientInfo> GetPagedList(int pPageIndex,int pPageSize,SortDirection pOrderBy,string pSortExpression,out int pRecordCount)
        {
            if(pPageIndex<=1)
            pPageIndex=1;
            List< ClientInfo> list = new List< ClientInfo>();

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

            foreach (Client  client  in collection)
            {
                ClientInfo clientInfo = new ClientInfo();
                LoadFromDAL(clientInfo,   client);
                list.Add(clientInfo);
            }
            pRecordCount=q.GetRecordCount();

            return list;
        }
Esempio n. 16
0
 public List <ClientInfo> GetPagedList(int pPageIndex, int pPageSize, SortDirection pOrderBy, string pSortExpression, out int pRecordCount)
 {
     return(ClientInfo.GetPagedList(pPageIndex, pPageSize, pOrderBy, pSortExpression, out pRecordCount));
 }
Esempio n. 17
0
 public object  SaveClientInfo(ClientInfo clientInfo)
 {
     clientInfo.Save();
     return(clientInfo.ClientId);
 }
Esempio n. 18
0
 protected void gvClient_RowUpdating(object sender, GridViewUpdateEventArgs e)
 {
     int ClientId = Convert.ToInt32(gvClient.DataKeys[e.RowIndex].Value);
     TextBox txtClientName = gvClient.Rows[e.RowIndex].FindControl("txtClientName") as TextBox;
     TextBox txtTelephone = gvClient.Rows[e.RowIndex].FindControl("txtTelephone") as TextBox;
     TextBox txtMailNo = gvClient.Rows[e.RowIndex].FindControl("txtMailNo") as TextBox;
     TextBox txtFax = gvClient.Rows[e.RowIndex].FindControl("txtFax") as TextBox;
     TextBox txtAddress = gvClient.Rows[e.RowIndex].FindControl("txtAddress") as TextBox;
     DropDownList ddlClient = gvClient.Rows[e.RowIndex].FindControl("ddlClientLevel") as DropDownList;
     try
     {
         ClientInfo client = new ClientInfo(ClientId);
         client.ClientName = txtClientName.Text.ToString();
         client.Telephone = txtTelephone.Text.ToString();
         client.MailNo = txtMailNo.Text.ToString();
         client.Fax = txtFax.Text.ToString();
         client.Address = txtAddress.Text.ToString();
         client.ClientLevelId = Convert.ToInt32(ddlClient.SelectedValue);
         client.Save();
         gvClient.EditIndex = -1;
         gvDataBind();
     }
     catch (Exception Ex)
     {
         ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('����ʧ�ܣ�" + Ex.Message + "');", true);
     }
 }
Esempio n. 19
0
 public void DeleteById(ClientInfo pClientInfo)
 {
     ClientInfo clientInfo = new ClientInfo(pClientInfo.ClientId);
     clientInfo.Delete();
 }
Esempio n. 20
0
 /// <summary>
 /// 复制一个对象,采用硬编码的方式,避免反射的低效
 /// </summary>
 /// <param name="pIndustryTypeInfoFrom"></param>
 /// <param name="pIndustryTypeInfoTo"></param>
 public static void Copy(ClientInfo pClientInfoFrom, ClientInfo pClientInfoTo)
 {
     pClientInfoTo.ClientId = pClientInfoFrom.clientId;
      		pClientInfoTo.ClientName = pClientInfoFrom.clientName;
      		pClientInfoTo.ClientLevelId = pClientInfoFrom.clientLevelId;
      		pClientInfoTo.Address = pClientInfoFrom.address;
      		pClientInfoTo.Telephone = pClientInfoFrom.telephone;
      		pClientInfoTo.MailNo = pClientInfoFrom.mailNo;
      		pClientInfoTo.Fax = pClientInfoFrom.fax;
      		pClientInfoTo.EmployeeId = pClientInfoFrom.employeeId;
      		pClientInfoTo.ClientTypeId = pClientInfoFrom.clientTypeId;
      		pClientInfoTo.SheetNum = pClientInfoFrom.sheetNum;
     pClientInfoTo.Loaded=pClientInfoFrom.Loaded;
 }