Ejemplo n.º 1
0
        protected void btnCommit_Click(object sender, EventArgs e)
        {
            string agentName    = txtName.Text.Trim();
            string agentContact = txtContact.Text.Trim();
            string address      = txtAddress.Text.Trim();
            string tel          = txtTel.Text.Trim();

            string strType = ddlAgentType.SelectedValue;

            HYCashierDAL.CahierMgrDAL dal   = new HYCashierDAL.CahierMgrDAL();
            AgentInfoEntity           agent = new AgentInfoEntity();

            agent.Address   = address;
            agent.AgentID   = dal.GetAgentID();
            agent.AgentName = agentName;
            agent.AgentType = int.Parse(strType);
            agent.Contact   = agentContact;
            agent.Tel       = tel;
            agent.CreateUsr = LoginUser.ClientID;
            string js = "";

            if (dal.AddAgent(agent))
            {
                js = "alert('新增成功'); window.parent.closeDialog();";
            }
            else
            {
                js = "alert('新增失败');";
            }
            Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "customJs", js, true);
            // agent.UpAgentID
        }
Ejemplo n.º 2
0
        public bool UpdateAgent(AgentInfoEntity agentInfo)
        {
            bool flag = false;

            string sql = "update AgentInfo set AgentName='" + agentInfo.AgentName + "',AgentType=" + agentInfo.AgentType
                         + ",UpAgentID='" + agentInfo.UpAgentID + "',Address='" + agentInfo.Address + "',Tel='" + agentInfo.Tel
                         + "',Contact='" + agentInfo.Contact + "',Note='" + agentInfo.Note
                         + "',UpdateTime=now(),UpdateUsr='******'  where AgentID='" + agentInfo.AgentID + "'";

            flag = DbHelper.ExecuteNonQuery(sql) > 0;


            return(flag);
        }
Ejemplo n.º 3
0
        public bool AddAgent(AgentInfoEntity agentInfo)
        {
            bool flag = false;

            string sql = @"insert into AgentInfo (AgentID ,AgentName,AgentType,UpAgentID,Address,Tel,
Contact,Status,Note,CreateTime,CreateUsr) values('";

            sql += agentInfo.AgentID + "','" + agentInfo.AgentName + "'," + agentInfo.AgentType + ",'"
                   + agentInfo.UpAgentID + "','" + agentInfo.Address + "','" + agentInfo.Tel + "','"
                   + agentInfo.Contact + "'," + agentInfo.Status + ",'" + agentInfo.Note + "',now(),'" + agentInfo.CreateUsr + "')";

            flag = DbHelper.ExecuteNonQuery(sql) > 0;


            return(flag);
        }