Ejemplo n.º 1
0
        private void BindData()
        {
            //TODO: bind Dropdownlist,change accordingly
            txtACTCustID.BindDropDownList(svr.GetCustomer(), "CustName", "CustID");
            txtACTType.BindDropDownList(svr.GetActionType(), "ACTType", "ID");

            //bind entity
            var entity = (vw_CRMAction)svr.LoadById(typeof(vw_CRMAction), "ACTID", hidID.Value);

            if (entity != null)
            {
                txtACTCustID.Text = entity.CustID.ToString();
                lblCust.Text      = entity.CustName;
                txtACTID.Text     = entity.ACTID.ToString();

                if (entity.ACTSubject != null)
                {
                    txtACTSubject.Text = entity.ACTSubject.ToString();
                }
                if (entity.ACTType != null)
                {
                    txtACTType.SelectedByValue(entity.ACTTypeID.ToString());
                }
                if (entity.ACTBeginDate != null)
                {
                    txtACTBeginDate.Text = ((DateTime)entity.ACTBeginDate).ToString(GetREMes("DateTimeFormatStringCS"));
                }
                if (entity.ACTEndDate != null)
                {
                    txtACTEndDate.Text = ((DateTime)entity.ACTEndDate).ToString(GetREMes("DateTimeFormatStringCS"));
                }
                if (entity.ACTContent != null)
                {
                    txtACTContent.Text = entity.ACTContent.ToString();
                }

                if (entity.ACTCDate != null)
                {
                    txtACTCDate.Text = entity.ACTCDate.ToString(GetREMes("DateTimeFormatStringCS"));
                }
                txtACTCUserID.Value = entity.ACTCUser.ToString();
                if (entity.ACTCUserName != null)
                {
                    txtACTCUser.Text = entity.ACTCUserName.ToString();
                }

                if (entity.ACTModifyDate != null)
                {
                    txtACTModifyDate.Text = entity.ACTModifyDate.ToString(GetREMes("DateTimeFormatStringCS"));
                }
                txtACTModifyUserID.Value = entity.ACTModifyUser.ToString();
                if (entity.ACTModifyUserName != null)
                {
                    txtACTModifyUser.Text = entity.ACTModifyUserName.ToString();
                }
            }
            else
            {
                //新建行动记录
                txtACTType.SelectedByValue(Request["ACType"]);
                txtACTCustID.SelectedByValue(Request["CustID"]);
                lblCust.Text             = txtACTCustID.SelectedItem.Text;
                txtACTCDate.Text         = DateTime.Now.ToString(GetREMes("DateTimeFormatStringCS"));
                txtACTCUserID.Value      = base.LoginUserID.ToString();
                txtACTCUser.Text         = base.LoginUserName;
                txtACTModifyDate.Text    = DateTime.Now.ToString(GetREMes("DateTimeFormatStringCS"));
                txtACTModifyUserID.Value = base.LoginUserID.ToString();
                txtACTModifyUser.Text    = base.LoginUserName;
            }
        }