예제 #1
0
        protected void btnSave_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            if (txtName.Text.Trim() == "")
            {
                lblErrMsg.Text = "����������������";
                return;
            }

            if (txtNickname.Text.Trim() == "")
            {
                lblErrMsg.Text = "�����������dzƣ�";
                return;
            }

            if (txtDwellAddress.Text.Trim() == "")
            {
                lblErrMsg.Text = "��������ϵ��ַ��";
                return;
            }

            if (txtPhone.Text.Trim() == "")
            {
                lblErrMsg.Text = "��������ϵ�绰��";
                return;
            }

            if (scArea.DistrictSysNo == AppConst.IntNull)
            {
                lblErrMsg.Text = "��ѡ�����(����ʡ���С�����)";
                return;
            }

            if (txtCellPhone.Text.Trim() != "")
            {
                if (!Util.IsCellNumber(txtCellPhone.Text.Trim()))
                {
                    lblErrMsg.Text = "�ֻ������ʽ����ȷ�������Բ�����";
                    return;
                }
            }

            if (txtZip.Text.Trim() == "")
            {
                lblErrMsg.Text = "�������������룡";
                return;
            }

            if (txtZip.Text.Trim() != "")
            {
                if (!Util.IsZipCode(txtZip.Text.Trim()))
                {
                    lblErrMsg.Text = "���������ʽ����ȷ��";
                    return;
                }
            }

            if (String.IsNullOrEmpty(txtBirthDay.Text.ToString()))
            {
                lblErrMsg.Text = "���ղ���Ϊ��";
                return;
            }

            if (!Util.IsEmailAddress(txtEmail.Text.Trim()))
            {
                lblErrMsg.Text = "Email��ַ��ʽ����ȷ";
                return;
            }

            IcsonSessionInfo oSession = (IcsonSessionInfo)Session["IcsonSessionInfo"];
            if (oSession == null)
            {
                oSession = new IcsonSessionInfo();
                Session["IcsonSessionInfo"] = oSession;
            }

            if (oSession.sCustomer == null || oSession.sCustomer.SysNo == AppConst.IntNull)
            {
                string url = "../CustomError.aspx?msg=" + Server.UrlEncode("ȱ��ע����Ϣ�����ܸ��»����ע�ᣬ���¼");
                Response.Redirect(url);
            }

            bool isOK = false;
            CustomerInfo oCustomer = oSession.sCustomer;
            try
            {
                oCustomer.CustomerName = txtName.Text.Trim();
                oCustomer.NickName = txtNickname.Text.Trim();
                oCustomer.Gender = int.Parse(rblGeneder.SelectedItem.Value.Trim());
                oCustomer.Phone = txtPhone.Text.Trim();
                oCustomer.CellPhone = txtCellPhone.Text.Trim();
                oCustomer.Fax = txtFax.Text.Trim();
                oCustomer.DwellAreaSysNo = scArea.AreaSysNo;
                oCustomer.DwellZip = txtZip.Text.Trim();
                oCustomer.DwellAddress = txtDwellAddress.Text.Trim();
                oCustomer.Email = txtEmail.Text.Trim();
                oCustomer.BirthDay = txtBirthDay.Text.Trim();

                Hashtable ht = new Hashtable(20);

                ht.Add("SysNo", oCustomer.SysNo);
                ht.Add("CustomerName", oCustomer.CustomerName);
                ht.Add("Nickname", oCustomer.NickName);
                ht.Add("Gender", oCustomer.Gender);
                ht.Add("Phone", oCustomer.Phone);
                ht.Add("CellPhone", oCustomer.CellPhone);
                ht.Add("Fax", oCustomer.Fax);
                ht.Add("DwellAreaSysNo", oCustomer.DwellAreaSysNo);
                ht.Add("DwellZip", oCustomer.DwellZip);
                ht.Add("DwellAddress", oCustomer.DwellAddress);
                ht.Add("Email", oCustomer.Email);
                ht.Add("Birthday", oCustomer.BirthDay);
                CustomerManager.GetInstance().Update(ht);

                isOK = true;
                lblErrMsg.Text = "���¸�����Ϣ�ɹ�";
            }
            catch (BizException exp)
            {
                lblErrMsg.Text = exp.Message;
            }
            catch (Exception exp)
            {
                ErrorLog.GetInstance().Write(exp.ToString());
                string url = "../CustomError.aspx?msg=" + Server.UrlEncode("�����û���Ϣʧ��");
                Response.Redirect(url);
            }

            if (this.opt == "New" && isOK)
            {

                //��ע���û�����ϵ��������ΪĬ�ϵ��ջ���ַ��ӵ��ջ���ַ����
                CustomerAddressInfo caInfo = new CustomerAddressInfo();
                caInfo.CustomerSysNo = oCustomer.SysNo;
                caInfo.Brief = "�ջ���ַ1";
                caInfo.Contact = txtName.Text.Trim();
                caInfo.Name = txtName.Text.Trim();
                caInfo.Phone = txtPhone.Text.Trim();
                caInfo.CellPhone = txtCellPhone.Text.Trim();
                caInfo.Fax = txtFax.Text.Trim();
                caInfo.AreaSysNo = scArea.AreaSysNo;
                caInfo.Zip = txtZip.Text.Trim();
                caInfo.Address = txtDwellAddress.Text.Trim();
                caInfo.IsDefault = (int)AppEnum.BiStatus.Valid;
                caInfo.UpdateTime = DateTime.Now;
                CustomerManager.GetInstance().InsertCustomerAddress(caInfo);

                Response.Redirect("../Account/AddressManagement.html");
                //Response.Redirect("Register2.aspx?opt=reg");
            }
        }
예제 #2
0
 public int UpdateCustomerAddress(CustomerAddressInfo oParam)
 {
     return new CustomerDac().Update(oParam);
 }
예제 #3
0
 private void map(CustomerAddressInfo oParam, DataRow tempdr)
 {
     oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]);
     oParam.CustomerSysNo = Util.TrimIntNull(tempdr["CustomerSysNo"]);
     oParam.Brief = Util.TrimNull(tempdr["Brief"]);
     oParam.Name = Util.TrimNull(tempdr["Name"]);
     oParam.Contact = Util.TrimNull(tempdr["Contact"]);
     oParam.Phone = Util.TrimNull(tempdr["Phone"]);
     oParam.CellPhone = Util.TrimNull(tempdr["CellPhone"]);
     oParam.Fax = Util.TrimNull(tempdr["Fax"]);
     oParam.Address = Util.TrimNull(tempdr["Address"]);
     oParam.Zip = Util.TrimNull(tempdr["Zip"]);
     oParam.AreaSysNo = Util.TrimIntNull(tempdr["AreaSysNo"]);
     oParam.IsDefault = Util.TrimIntNull(tempdr["IsDefault"]);
     oParam.UpdateTime = Util.TrimDateNull(tempdr["UpdateTime"]);
 }
예제 #4
0
 public int InsertCustomerAddress(CustomerAddressInfo oParam)
 {
     return new CustomerDac().Insert(oParam);
 }
예제 #5
0
 public CustomerAddressInfo LoadCustomerAddress(int sysno)
 {
     string sql = "select * from customer_address where sysno=" + sysno;
     DataSet ds = SqlHelper.ExecuteDataSet(sql);
     if (Util.HasMoreRow(ds))
     {
         CustomerAddressInfo o = new CustomerAddressInfo();
         map(o, ds.Tables[0].Rows[0]);
         return o;
     }
     else
         return null;
 }
예제 #6
0
파일: MyAddress.aspx.cs 프로젝트: ue96/ue96
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            AddressInfo.Visible = true;
            if (txtName.Text == "" || txtName.Text == null)
            {
                lblErrMsg.Text = "请输入收货人姓名!";
                return;
            }
            if (txtContact.Text == "" || txtContact.Text == null)
            {
                lblErrMsg.Text = "请输入收货联系人信息!";
                return;
            }
            if (txtPhone.Text == null || txtPhone.Text == "")
            {
                lblErrMsg.Text = "请输入收货联系电话!";
                return;
            }
            if (txtAddress.Text == "" || txtAddress.Text == null)
            {
                lblErrMsg.Text = "请输入收货联系地址!";
                return;
            }
            if (scArea.DistrictSysNo == AppConst.IntNull)
            {
                lblErrMsg.Text = "请选择地区(包括省、市、区县)";
                return;
            }

            if (txtCellPhone.Text.Trim() != "")
            {
                if (!Util.IsCellNumber(txtCellPhone.Text.Trim()))
                {
                    lblErrMsg.Text = "手机号码格式不正确,您可以不输入";
                    return;
                }
            }

            if (txtZip.Text.Trim() == "")
            {
                lblErrMsg.Text = "请输入邮政编码!";
                return;
            }

            if (txtZip.Text.Trim() != "")
            {
                if (!Util.IsZipCode(txtZip.Text.Trim()))
                {
                    lblErrMsg.Text = "邮政编码格式不正确!";
                    return;
                }
            }

            CustomerAddressInfo o = new CustomerAddressInfo();
            int sysno = Int32.Parse(lblSysNo.Text);
            o.SysNo = sysno;
            o.CustomerSysNo = Int32.Parse(lblCustomerSysNo.Text);
            o.Brief = txtBrief.Text.Trim();
            o.Name = txtName.Text.Trim();
            o.Contact = txtContact.Text.Trim();
            o.CellPhone = txtCellPhone.Text.Trim();
            o.Phone = txtPhone.Text.Trim();
            o.Address = txtAddress.Text.Trim();
            o.AreaSysNo = scArea.AreaSysNo;
            o.Zip = txtZip.Text.Trim();
            o.Fax = txtFax.Text.Trim();
            o.IsDefault = Int32.Parse(lblIsDefault.Text);
            o.UpdateTime = DateTime.Now;

            if (sysno > 0)
            {
                CustomerManager.GetInstance().UpdateCustomerAddress(o);
            }
            else
            {
                if (CustomerManager.GetInstance().LoadCustomerAddressByCustomer(o.CustomerSysNo) == null)
                {
                    o.IsDefault = (int)AppEnum.BiStatus.Valid;
                }
                CustomerManager.GetInstance().InsertCustomerAddress(o);
            }
            BindAddressList();

            btnSubmit.Enabled = false;
            AddressInfo.Visible = false;
        }
예제 #7
0
파일: Comfirm.aspx.cs 프로젝트: ue96/ue96
        //protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
        //{
        //    if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        //    {
        //        Label lbl1 = e.Item.FindControl("lblIsDefault") as Label;
        //        Label lbl2 = e.Item.FindControl("lblBrief") as Label;
        //        ImageButton imgbtn = e.Item.FindControl("btnSelect") as ImageButton;
        //        int IsDefault = Int32.Parse(lbl1.Text);
        //        if (IsDefault == (int)AppEnum.BiStatus.Valid)
        //        {
        //            lbl2.Text = lbl2.Text + "[默认]";
        //            imgbtn.ImageUrl = "../Images/site/SelectedIcon.jpg";
        //            int sysno = Int32.Parse(DataList1.DataKeys[e.Item.ItemIndex].ToString());
        //            lblSysNo.Text = sysno.ToString();
        //            CustomerAddressInfo o = CustomerManager.GetInstance().LoadCustomerAddress(sysno);
        //            txtBrief.Text = o.Brief;
        //            txtName.Text = o.Name;
        //            txtContact.Text = o.Contact;
        //            txtCellPhone.Text = o.CellPhone;
        //            txtPhone.Text = o.Phone;
        //            scArea.AreaSysNo = o.AreaSysNo;
        //            txtAddress.Text = o.Address;
        //            txtZip.Text = o.Zip;
        //            txtFax.Text = o.Fax;
        //        }
        //        else
        //        {
        //            imgbtn.ImageUrl = "../Images/site/UnSelectedIcon.jpg";
        //        }
        //    }
        //}
        protected void btnNext_Click(object sender, EventArgs e)
        {
            if (txtName.Text.Trim() == "")
            {
                lblErrMsg.Text = "请输入收货人姓名!";
                return;
            }

            if (txtAddress.Text.Trim() == "")
            {
                lblErrMsg.Text = "请输入联系地址!";
                return;
            }

            if (txtPhone.Text.Trim() == "")
            {
                lblErrMsg.Text = "请输入联系电话!";
                return;
            }

            if (scArea.DistrictSysNo == AppConst.IntNull)
            {
                lblErrMsg.Text = "请选择地区(包括省、市、区县)";
                return;
            }

            if (txtCellPhone.Text.Trim() != "")
            {
                if (!Util.IsCellNumber(txtCellPhone.Text.Trim()))
                {
                    lblErrMsg.Text = "手机号码格式不正确,您可以不输入";
                    return;
                }
            }

            if (txtZip.Text.Trim() == "")
            {
                lblErrMsg.Text = "请输入邮政编码!";
                return;
            }
            if (txtZip.Text.Trim() != "")
            {
                if (!Util.IsZipCode(txtZip.Text.Trim()))
                {
                    lblErrMsg.Text = "邮政编码格式不正确!";
                    return;
                }
            }

            string msgLimited1 = "";  //普包、EMS限运
            string msgLimited2 = "";  //圆通航空限运

            Hashtable cartHash = CartManager.GetInstance().GetCartHash();
            if (cartHash.Count == 0)
                Response.Redirect("ShoppingCart.aspx");
            Hashtable sysNoHash = new Hashtable(5);
            foreach (CartInfo cartInfo in cartHash.Values)
            {
                sysNoHash.Add(cartInfo.ProductSysNo, null);
            }

            //笔记本、打火机 是圆通航空限运,笔记本是普包、EMS不限运
            string LimitedShip = "";  //包含1,为盘片、音箱耳机、液体、打火机;包含2为笔记本、打火机,1为普包、EMS全部限运,2为圆通航空限运

            Hashtable ProductHash = ProductManager.GetInstance().LoadProducts(sysNoHash);
            foreach (ProductBasicInfo oInfo in ProductHash.Values)
            {
                //盘片、音箱耳机、液体、打火机, 笔记本、液晶显示器、液晶电视
                //if (",62,64,67,72,73,74,83,169,170,171,186,191,196,197,198,210,214,239,287,434,111,234,386,562,576,577,578,579,580,".IndexOf("," + oInfo.C3SysNo + ",") >= 0)
                //笔记本,液晶不再限运
                if (",62,64,67,72,73,74,83,169,170,171,186,191,196,197,198,210,214,239,287,434,576,577,578,579,580,".IndexOf("," + oInfo.C3SysNo + ",") >= 0)
                {
                    msgLimited1 += oInfo.ProductName + "<br />";
                    LimitedShip += "1";
                }
                if (",234,562,434,576,577,578,579,580,".IndexOf("," + oInfo.C3SysNo + ",") >= 0)  //笔记本、打火机
                {
                    LimitedShip += "2";
                }
                if (oInfo.C3SysNo == 234) //笔记本
                {
                    msgLimited2 += oInfo.ProductName + "<br />";
                }
            }
            if (LimitedShip.Length > 0)
            {
                Session["HasLimitedShipProduct"] = LimitedShip;
                Session["HasLimitedShipProductInfo1"] = msgLimited1;
                Session["HasLimitedShipProductInfo2"] = msgLimited2;
                //msgLimited += " 属限运商品,请从购物车中删除! <a href='http://www.icson.com/Service/NewsDetail.aspx?Type=Bulletin&ID=35' target='_blank'>查看限运说明</a>";
            }
            else
            {
                Session["HasLimitedShipProduct"] = "0";
                Session["HasLimitedShipProductInfo1"] = "";
                Session["HasLimitedShipProductInfo2"] = "";
            }

            //if (scArea.ProvinceSysNo != 1 && scArea.ProvinceSysNo != 1591 && scArea.ProvinceSysNo != 3225 && scArea.ProvinceSysNo != 2621)
            //{
            //    if (msgLimited.Length > 0)
            //    {
            //        lblErrMsg.Text = msgLimited;
            //        return;
            //    }
            //}

            //是否是新增地址状态
            if (ddlAddresses.SelectedValue == "create")
            {
                ////将原来的默认地址取消默认
                //oldAddress.IsDefault = -1;
                //CustomerManager.GetInstance().UpdateCustomerAddress();

                //新地址保存
                CustomerAddressInfo o = new CustomerAddressInfo();
                o.CustomerSysNo = oSession.sCustomer.SysNo;
                o.Brief = txtBrief.Text.Trim();
                o.Name = txtName.Text.Trim();
                o.Contact = txtContact.Text.Trim();
                o.Address = txtAddress.Text.Trim();
                o.AreaSysNo = scArea.AreaSysNo;
                o.Phone = txtPhone.Text.Trim();
                o.CellPhone = txtCellPhone.Text.Trim();
                o.Zip = txtZip.Text.Trim();
                o.Fax = txtFax.Text.Trim();
                o.IsDefault = (int)AppEnum.BiStatus.InValid;
                o.UpdateTime = DateTime.Now;

                if (lblSysNo.Text.Trim() == "")//原来没有默认地址,就将新增的设置为默认地址
                    o.IsDefault = 0;

                CustomerManager.GetInstance().InsertCustomerAddress(o);

                //新地址存入当前用户信息
                oSession.sSO = new SOInfo();
                oSession.sSO.CustomerSysNo = o.CustomerSysNo;
                oSession.sSO.ReceiveAddress = o.Address;
                oSession.sSO.ReceiveAreaSysNo = o.AreaSysNo;
                oSession.sSO.ReceiveCellPhone = o.CellPhone;
                oSession.sSO.ReceiveContact = o.Contact;
                oSession.sSO.ReceiveName = o.Name;
                oSession.sSO.ReceivePhone = o.Phone;
                oSession.sSO.ReceiveZip = o.Zip;

                Response.Redirect("CheckOut4.aspx");

            }
            else
            {
                int sysno = Int32.Parse(ddlAddresses.SelectedValue);
                CustomerAddressInfo o = CustomerManager.GetInstance().LoadCustomerAddress(sysno);
                o.Brief = txtBrief.Text.Trim();
                o.Name = txtName.Text.Trim();
                o.Contact = txtContact.Text.Trim();
                o.Address = txtAddress.Text.Trim();
                o.AreaSysNo = scArea.AreaSysNo;
                o.Phone = txtPhone.Text.Trim();
                o.CellPhone = txtCellPhone.Text.Trim();
                o.Zip = txtZip.Text.Trim();
                o.Fax = txtFax.Text.Trim();
                CustomerManager.GetInstance().UpdateCustomerAddress(o);

                oSession.sSO = new SOInfo();
                oSession.sSO.CustomerSysNo = o.CustomerSysNo;
                oSession.sSO.ReceiveAddress = o.Address;
                oSession.sSO.ReceiveAreaSysNo = o.AreaSysNo;
                oSession.sSO.ReceiveCellPhone = o.CellPhone;
                oSession.sSO.ReceiveContact = o.Contact;
                oSession.sSO.ReceiveName = o.Name;
                oSession.sSO.ReceivePhone = o.Phone;
                oSession.sSO.ReceiveZip = o.Zip;

                Response.Redirect("CheckOut.aspx");
            }

            //if(lblSysNo.Text == "0")
            //{
            //    CustomerAddressInfo o = new CustomerAddressInfo();
            //    o.CustomerSysNo = oSession.sCustomer.SysNo;
            //    o.Brief = txtBrief.Text.Trim();
            //    o.Name = txtName.Text.Trim();
            //    o.Contact = txtContact.Text.Trim();
            //    o.Address = txtAddress.Text.Trim();
            //    o.AreaSysNo = scArea.AreaSysNo;
            //    o.Phone = txtPhone.Text.Trim();
            //    o.CellPhone = txtCellPhone.Text.Trim();
            //    o.Zip = txtZip.Text.Trim();
            //    o.Fax = txtFax.Text.Trim();
            //    o.IsDefault = (int) AppEnum.BiStatus.InValid;
            //    o.UpdateTime = DateTime.Now;
            //    CustomerManager.GetInstance().InsertCustomerAddress(o);

            //    oSession.sSO = new SOInfo();
            //    oSession.sSO.CustomerSysNo = o.CustomerSysNo;
            //    oSession.sSO.ReceiveAddress = o.Address;
            //    oSession.sSO.ReceiveAreaSysNo = o.AreaSysNo;
            //    oSession.sSO.ReceiveCellPhone = o.CellPhone;
            //    oSession.sSO.ReceiveContact = o.Contact;
            //    oSession.sSO.ReceiveName = o.Name;
            //    oSession.sSO.ReceivePhone = o.Phone;
            //    oSession.sSO.ReceiveZip = o.Zip;

            //    Response.Redirect("CheckOut2.aspx");
            //}
            //else
            //{
            //    foreach (DataListItem item in DataList1.Items)
            //    {
            //        if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem || item.ItemType == ListItemType.SelectedItem)
            //        {
            //            ImageButton imgbtn = item.FindControl("btnSelect") as ImageButton;
            //            if (imgbtn.ImageUrl == "../Images/site/SelectedIcon.jpg")
            //            {
            //                int sysno = Int32.Parse(DataList1.DataKeys[item.ItemIndex].ToString());
            //                CustomerAddressInfo o = CustomerManager.GetInstance().LoadCustomerAddress(sysno);
            //                o.Brief = txtBrief.Text.Trim();
            //                o.Name = txtName.Text.Trim();
            //                o.Contact = txtContact.Text.Trim();
            //                o.Address = txtAddress.Text.Trim();
            //                o.AreaSysNo = scArea.AreaSysNo;
            //                o.Phone = txtPhone.Text.Trim();
            //                o.CellPhone = txtCellPhone.Text.Trim();
            //                o.Zip = txtZip.Text.Trim();
            //                o.Fax = txtFax.Text.Trim();
            //                CustomerManager.GetInstance().UpdateCustomerAddress(o);

            //                oSession.sSO = new SOInfo();
            //                oSession.sSO.CustomerSysNo = o.CustomerSysNo;
            //                oSession.sSO.ReceiveAddress = o.Address;
            //                oSession.sSO.ReceiveAreaSysNo = o.AreaSysNo;
            //                oSession.sSO.ReceiveCellPhone = o.CellPhone;
            //                oSession.sSO.ReceiveContact = o.Contact;
            //                oSession.sSO.ReceiveName = o.Name;
            //                oSession.sSO.ReceivePhone = o.Phone;
            //                oSession.sSO.ReceiveZip = o.Zip;

            //                Response.Redirect("CheckOut2.aspx");
            //                break;
            //            }
            ////        }
            //    }

            //    //没有默认的收获地址,新增的一个设为默认
            //    CustomerAddressInfo o2 = new CustomerAddressInfo();
            //    o2.CustomerSysNo = oSession.sCustomer.SysNo;
            //    o2.Brief = txtBrief.Text.Trim();
            //    o2.Name = txtName.Text.Trim();
            //    o2.Contact = txtContact.Text.Trim();
            //    o2.Address = txtAddress.Text.Trim();
            //    o2.AreaSysNo = scArea.AreaSysNo;
            //    o2.Phone = txtPhone.Text.Trim();
            //    o2.CellPhone = txtCellPhone.Text.Trim();
            //    o2.Zip = txtZip.Text.Trim();
            //    o2.Fax = txtFax.Text.Trim();
            //    o2.IsDefault = (int)AppEnum.BiStatus.Valid;
            //    o2.UpdateTime = DateTime.Now;
            //    CustomerManager.GetInstance().InsertCustomerAddress(o2);

            //    oSession.sSO = new SOInfo();
            //    oSession.sSO.CustomerSysNo = o2.CustomerSysNo;
            //    oSession.sSO.ReceiveAddress = o2.Address;
            //    oSession.sSO.ReceiveAreaSysNo = o2.AreaSysNo;
            //    oSession.sSO.ReceiveCellPhone = o2.CellPhone;
            //    oSession.sSO.ReceiveContact = o2.Contact;
            //    oSession.sSO.ReceiveName = o2.Name;
            //    oSession.sSO.ReceivePhone = o2.Phone;
            //    oSession.sSO.ReceiveZip = o2.Zip;

            //    Response.Redirect("CheckOut2.aspx");
            //}
        }
예제 #8
0
파일: Comfirm.aspx.cs 프로젝트: ue96/ue96
        //protected void DataList1_ItemCommand(object source, DataListCommandEventArgs e)
        //{
        //    if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.SelectedItem)
        //    {
        //        if (e.CommandName == "Select")
        //        {
        //            foreach (DataListItem item in DataList1.Items)
        //            {
        //                if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem || item.ItemType == ListItemType.SelectedItem)
        //                {
        //                    ImageButton imgbtn = item.FindControl("btnSelect") as ImageButton;
        //                    if(item.ItemIndex == e.Item.ItemIndex)
        //                    {
        //                        imgbtn.ImageUrl = "../Images/site/SelectedIcon.jpg";
        //                    }
        //                    else
        //                    {
        //                        imgbtn.ImageUrl = "../Images/site/UnSelectedIcon.jpg";
        //                    }
        //                }
        //            }
        //            int sysno = Int32.Parse(DataList1.DataKeys[e.Item.ItemIndex].ToString());
        //            lblSysNo.Text = sysno.ToString();
        //            CustomerAddressInfo o = CustomerManager.GetInstance().LoadCustomerAddress(sysno);
        //            txtBrief.Text = o.Brief;
        //            txtName.Text = o.Name;
        //            txtContact.Text = o.Contact;
        //            txtCellPhone.Text = o.CellPhone;
        //            txtPhone.Text = o.Phone;
        //            scArea.AreaSysNo = o.AreaSysNo;
        //            txtAddress.Text = o.Address;
        //            txtZip.Text = o.Zip;
        //            txtFax.Text = o.Fax;
        //        }
        //    }
        //}
        //protected void lnkbtnNewAddress_Click(object sender, EventArgs e)
        //{
        //    foreach (DataListItem item in DataList1.Items)
        //    {
        //        if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem || item.ItemType == ListItemType.SelectedItem)
        //        {
        //            ImageButton imgbtn = item.FindControl("btnSelect") as ImageButton;
        //            imgbtn.ImageUrl = "../Images/site/UnSelectedIcon.jpg";
        //        }
        //    }
        //    lblSysNo.Text = "0";
        //    txtBrief.Text = "";
        //    txtName.Text = "";
        //    txtCellPhone.Text = "";
        //    txtPhone.Text = "";
        //    txtAddress.Text = "";
        //    scArea.AreaSysNo = AppConst.IntNull;
        //    txtZip.Text = "";
        //    txtFax.Text = "";
        //}
        /// <summary>
        /// 选择地址
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ddlAddresses_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (ddlAddresses.SelectedValue == "create")//创建新地址
            {

                oldAddress = CustomerManager.GetInstance().LoadCustomerAddress(Int32.Parse(lblSysNo.Text));

                lblSysNo.Text = "0";

                txtBrief.Text = "";
                txtName.Text = "";
                txtCellPhone.Text = "";
                txtPhone.Text = "";
                txtAddress.Text = "";
                scArea.AreaSysNo = AppConst.IntNull;
                txtZip.Text = "";
                txtFax.Text = "";
            }
            else //选择其他地址
            {

                int sysno = Int32.Parse(ddlAddresses.SelectedValue);
                lblSysNo.Text = sysno.ToString();
                CustomerAddressInfo o = CustomerManager.GetInstance().LoadCustomerAddress(sysno);
                txtBrief.Text = o.Brief;
                txtName.Text = o.Name;
                txtContact.Text = o.Contact;
                txtCellPhone.Text = o.CellPhone;
                txtPhone.Text = o.Phone;
                scArea.AreaSysNo = o.AreaSysNo;
                txtAddress.Text = o.Address;
                txtZip.Text = o.Zip;
                txtFax.Text = o.Fax;

            }
        }
예제 #9
0
파일: CustomerDac.cs 프로젝트: ue96/ue96
        public int Update(CustomerAddressInfo oParam)
        {
            string sql = @"UPDATE Customer_Address SET
                            CustomerSysNo=@CustomerSysNo, Brief=@Brief,
                            Name=@Name, Contact=@Contact,
                            Phone=@Phone, CellPhone=@CellPhone,
                            Fax=@Fax, Address=@Address,
                            Zip=@Zip, AreaSysNo=@AreaSysNo,
                            IsDefault=@IsDefault, UpdateTime=@UpdateTime
                            WHERE SysNo=@SysNo";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramCustomerSysNo = new SqlParameter("@CustomerSysNo", SqlDbType.Int, 4);
            SqlParameter paramBrief = new SqlParameter("@Brief", SqlDbType.NVarChar, 50);
            SqlParameter paramName = new SqlParameter("@Name", SqlDbType.NVarChar, 50);
            SqlParameter paramContact = new SqlParameter("@Contact", SqlDbType.NVarChar, 50);
            SqlParameter paramPhone = new SqlParameter("@Phone", SqlDbType.NVarChar, 50);
            SqlParameter paramCellPhone = new SqlParameter("@CellPhone", SqlDbType.NVarChar, 50);
            SqlParameter paramFax = new SqlParameter("@Fax", SqlDbType.NVarChar, 50);
            SqlParameter paramAddress = new SqlParameter("@Address", SqlDbType.NVarChar, 200);
            SqlParameter paramZip = new SqlParameter("@Zip", SqlDbType.NVarChar, 50);
            SqlParameter paramAreaSysNo = new SqlParameter("@AreaSysNo", SqlDbType.Int, 4);
            SqlParameter paramIsDefault = new SqlParameter("@IsDefault", SqlDbType.Int, 4);
            SqlParameter paramUpdateTime = new SqlParameter("@UpdateTime", SqlDbType.DateTime);

            if (oParam.SysNo != AppConst.IntNull)
                paramSysNo.Value = oParam.SysNo;
            else
                paramSysNo.Value = System.DBNull.Value;
            if (oParam.CustomerSysNo != AppConst.IntNull)
                paramCustomerSysNo.Value = oParam.CustomerSysNo;
            else
                paramCustomerSysNo.Value = System.DBNull.Value;
            if (oParam.Brief != AppConst.StringNull)
                paramBrief.Value = oParam.Brief;
            else
                paramBrief.Value = System.DBNull.Value;
            if (oParam.Name != AppConst.StringNull)
                paramName.Value = oParam.Name;
            else
                paramName.Value = System.DBNull.Value;
            if (oParam.Contact != AppConst.StringNull)
                paramContact.Value = oParam.Contact;
            else
                paramContact.Value = System.DBNull.Value;
            if (oParam.Phone != AppConst.StringNull)
                paramPhone.Value = oParam.Phone;
            else
                paramPhone.Value = System.DBNull.Value;
            if (oParam.CellPhone != AppConst.StringNull)
                paramCellPhone.Value = oParam.CellPhone;
            else
                paramCellPhone.Value = System.DBNull.Value;
            if (oParam.Fax != AppConst.StringNull)
                paramFax.Value = oParam.Fax;
            else
                paramFax.Value = System.DBNull.Value;
            if (oParam.Address != AppConst.StringNull)
                paramAddress.Value = oParam.Address;
            else
                paramAddress.Value = System.DBNull.Value;
            if (oParam.Zip != AppConst.StringNull)
                paramZip.Value = oParam.Zip;
            else
                paramZip.Value = System.DBNull.Value;
            if (oParam.AreaSysNo != AppConst.IntNull)
                paramAreaSysNo.Value = oParam.AreaSysNo;
            else
                paramAreaSysNo.Value = System.DBNull.Value;
            if (oParam.IsDefault != AppConst.IntNull)
                paramIsDefault.Value = oParam.IsDefault;
            else
                paramIsDefault.Value = System.DBNull.Value;
            if (oParam.UpdateTime != AppConst.DateTimeNull)
                paramUpdateTime.Value = oParam.UpdateTime;
            else
                paramUpdateTime.Value = System.DBNull.Value;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramCustomerSysNo);
            cmd.Parameters.Add(paramBrief);
            cmd.Parameters.Add(paramName);
            cmd.Parameters.Add(paramContact);
            cmd.Parameters.Add(paramPhone);
            cmd.Parameters.Add(paramCellPhone);
            cmd.Parameters.Add(paramFax);
            cmd.Parameters.Add(paramAddress);
            cmd.Parameters.Add(paramZip);
            cmd.Parameters.Add(paramAreaSysNo);
            cmd.Parameters.Add(paramIsDefault);
            cmd.Parameters.Add(paramUpdateTime);

            return SqlHelper.ExecuteNonQuery(cmd);
        }
예제 #10
0
파일: CustomerDac.cs 프로젝트: ue96/ue96
        //public int Update(Hashtable paramHash)
        //{
        //    StringBuilder sb = new StringBuilder(200);
        //    sb.Append("UPDATE Customer SET ");
        //    if ( paramHash != null && paramHash.Count != 0 )
        //    {
        //        int index = 0;
        //        foreach(string key in paramHash.Keys)
        //        {
        //            object item = paramHash[key];
        //            if ( key.ToLower()=="sysno" )
        //                continue;
        //            if ( index != 0 )
        //                sb.Append(",");
        //            index++;
        //            if (item is int || item is decimal)
        //            {
        //                sb.Append(key).Append("=").Append(item.ToString());
        //            }
        //            else if (item is string)
        //            {
        //                sb.Append(key).Append(" = ").Append(Util.ToSqlString(item.ToString()));
        //            }
        //            else if (item is DateTime)
        //            {
        //                sb.Append(key).Append(" = cast(").Append( Util.ToSqlString(((DateTime)item).ToString(AppConst.DateFormatLong))).Append(" as DateTime)");
        //            }
        //        }
        //    }
        //    sb.Append(" WHERE SysNo=").Append(paramHash["SysNo"]);
        //    return SqlHelper.ExecuteNonQuery(sb.ToString());
        //}
        public int Insert(CustomerAddressInfo oParam)
        {
            string sql = @"INSERT INTO Customer_Address
                            (
                            CustomerSysNo, Brief, Name, Contact,
                            Phone, CellPhone, Fax, Address,
                            Zip, AreaSysNo, IsDefault, UpdateTime
                            )
                            VALUES (
                            @CustomerSysNo, @Brief, @Name, @Contact,
                            @Phone, @CellPhone, @Fax, @Address,
                            @Zip, @AreaSysNo, @IsDefault, @UpdateTime
                            );set @SysNo = SCOPE_IDENTITY();";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramCustomerSysNo = new SqlParameter("@CustomerSysNo", SqlDbType.Int, 4);
            SqlParameter paramBrief = new SqlParameter("@Brief", SqlDbType.NVarChar, 50);
            SqlParameter paramName = new SqlParameter("@Name", SqlDbType.NVarChar, 50);
            SqlParameter paramContact = new SqlParameter("@Contact", SqlDbType.NVarChar, 50);
            SqlParameter paramPhone = new SqlParameter("@Phone", SqlDbType.NVarChar, 50);
            SqlParameter paramCellPhone = new SqlParameter("@CellPhone", SqlDbType.NVarChar, 50);
            SqlParameter paramFax = new SqlParameter("@Fax", SqlDbType.NVarChar, 50);
            SqlParameter paramAddress = new SqlParameter("@Address", SqlDbType.NVarChar, 200);
            SqlParameter paramZip = new SqlParameter("@Zip", SqlDbType.NVarChar, 50);
            SqlParameter paramAreaSysNo = new SqlParameter("@AreaSysNo", SqlDbType.Int, 4);
            SqlParameter paramIsDefault = new SqlParameter("@IsDefault", SqlDbType.Int, 4);
            SqlParameter paramUpdateTime = new SqlParameter("@UpdateTime", SqlDbType.DateTime);
            paramSysNo.Direction = ParameterDirection.Output;
            if (oParam.CustomerSysNo != AppConst.IntNull)
                paramCustomerSysNo.Value = oParam.CustomerSysNo;
            else
                paramCustomerSysNo.Value = System.DBNull.Value;
            if (oParam.Brief != AppConst.StringNull)
                paramBrief.Value = oParam.Brief;
            else
                paramBrief.Value = System.DBNull.Value;
            if (oParam.Name != AppConst.StringNull)
                paramName.Value = oParam.Name;
            else
                paramName.Value = System.DBNull.Value;
            if (oParam.Contact != AppConst.StringNull)
                paramContact.Value = oParam.Contact;
            else
                paramContact.Value = System.DBNull.Value;
            if (oParam.Phone != AppConst.StringNull)
                paramPhone.Value = oParam.Phone;
            else
                paramPhone.Value = System.DBNull.Value;
            if (oParam.CellPhone != AppConst.StringNull)
                paramCellPhone.Value = oParam.CellPhone;
            else
                paramCellPhone.Value = System.DBNull.Value;
            if (oParam.Fax != AppConst.StringNull)
                paramFax.Value = oParam.Fax;
            else
                paramFax.Value = System.DBNull.Value;
            if (oParam.Address != AppConst.StringNull)
                paramAddress.Value = oParam.Address;
            else
                paramAddress.Value = System.DBNull.Value;
            if (oParam.Zip != AppConst.StringNull)
                paramZip.Value = oParam.Zip;
            else
                paramZip.Value = System.DBNull.Value;
            if (oParam.AreaSysNo != AppConst.IntNull)
                paramAreaSysNo.Value = oParam.AreaSysNo;
            else
                paramAreaSysNo.Value = System.DBNull.Value;
            if (oParam.IsDefault != AppConst.IntNull)
                paramIsDefault.Value = oParam.IsDefault;
            else
                paramIsDefault.Value = System.DBNull.Value;
            if (oParam.UpdateTime != AppConst.DateTimeNull)
                paramUpdateTime.Value = oParam.UpdateTime;
            else
                paramUpdateTime.Value = System.DBNull.Value;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramCustomerSysNo);
            cmd.Parameters.Add(paramBrief);
            cmd.Parameters.Add(paramName);
            cmd.Parameters.Add(paramContact);
            cmd.Parameters.Add(paramPhone);
            cmd.Parameters.Add(paramCellPhone);
            cmd.Parameters.Add(paramFax);
            cmd.Parameters.Add(paramAddress);
            cmd.Parameters.Add(paramZip);
            cmd.Parameters.Add(paramAreaSysNo);
            cmd.Parameters.Add(paramIsDefault);
            cmd.Parameters.Add(paramUpdateTime);

            return SqlHelper.ExecuteNonQuery(cmd, out oParam.SysNo);
        }