Exemplo n.º 1
0
 public int EditInformation(FormCollection f)
 {
     try
     {
         AccountBusiness ab = new AccountBusiness();
         int userId = Convert.ToInt32(Session["UserId"]);
         string sName = f["customerName"];
         string sEmail = f["customerEmail"];
         if ((int)Session["UserRole"] == 1)
         {
             if (ab.checkEmailExisted(userId, sEmail))
             {
                 return -1;
             }
             ab.ChangeInformation(userId, sName, sEmail, null,null,null);
         }
         if ((int)Session["UserRole"] == 2)
         {
             if (ab.checkEmailExisted(userId, sEmail))
             {
                 return -1;
             }
             string sAddress = f["customerAddress"];
             string sPhone = f["customerPhoneNumber"];
             if (ab.checkPhoneExisted(userId, sPhone))
             {
                 return -2;
             }
             ab.ChangeInformation(userId, sName, sEmail, sAddress, null, sPhone);
         }
         return 1;
     }
     catch
     {
         return -3;
     }
 }
Exemplo n.º 2
0
 public int ChangeInformationConfirm(FormCollection f)
 {
     try
     {
         AccountBusiness ab = new AccountBusiness();
         int cusUserId = Convert.ToInt32(Session["UserId"]);
         string sName = f["txtName"];
         string sAddress = f["txtAdress"];
         string sEmail = f["txtEmail"];
         string sTaxCode = f["txtTaxCode"];
         string sPhone = f["txtPhone"];
         if (ab.checkEmailExisted(cusUserId, sEmail))
         {
             return -1;
         }
         if (ab.checkPhoneExisted(cusUserId, sPhone))
         {
             return -2;
         }
         if (ab.checkTaxCodeExisted(cusUserId, sTaxCode))
         {
             return -3;
         }
         ab.ChangeInformation(cusUserId, sName, sEmail, sAddress, sTaxCode, sPhone);
         return 1;
     }
     catch
     {
         return -4;
     }
 }