public void addToCartClicked(object sender, EventArgs e)
        {
            //messageHolder.Controls.Clear();

            int    itemID     = int.Parse((sender as Button).ID);
            String clientName = (String)Session["name"];

            if (clientName != null)
            {
                String         connectionString = WebConfigurationManager.ConnectionStrings["DBLENGUAJES"].ToString();
                ClientBusiness itemBusiness     = new ClientBusiness(connectionString);

                String result = itemBusiness.addToCart(clientName, itemID);

                if (result == "OK")
                {
                    messageHolder.Controls.Add(
                        new LiteralControl(Message.successMessage("Exito al agregar el item al carrito"))
                        );
                }
                else
                {
                    messageHolder.Controls.Add(
                        new LiteralControl(Message.errorMessage(result))
                        );
                }
            }
        }
Exemplo n.º 2
0
        public bool UpdateBusinessDetails(ClientBusiness clientBizObj)
        {
            try
            {
                StringBuilder updateQuery = new StringBuilder("UPDATE [dbo].[ClientBusinessDetails] SET [ClientId] = @ClientId, [BusinessCategoryTypeId] = @BusinessCategoryTypeId, ");
                updateQuery.Append("[BusinessSubCategoryType] = @BusinessSubCategoryType, [PayPeriodTypeId] = @PayPeriodTypeId, ");
                updateQuery.Append("[BusinessHours] = @BusinessHours, [IsPremiumCustomer] = @IsPremiumCustomer, [NegotiatedPrice] = @NegotiatedPrice, ");
                updateQuery.Append("[IsBulkDataReceived] = @IsBulkDataReceived, [IsMobileNumberToBePublicAccess] = @IsMobileNumberToBePublicAccess, ");
                updateQuery.Append("[LocationLongitude] = @LocationLongitude, [LocationLattitude] = @LocationLattitude, [CreatedDate] = @CreatedDate, ");
                updateQuery.Append("[IsActive] = @IsActive, [BusinessDescription] = @BusinessDescription, [BusinessGalleryPath] = @BusinessGalleryPath, ");
                updateQuery.Append("[BusinessWebSite] = @BusinessWebSite, [BusinessLogoPath] = @BusinessLogoPath, ");
                updateQuery.Append("[BusinessSubCategoryNativeType] = @BusinessSubCategoryNativeType WHERE ClientBusinessDetailId = @ClientBusinessDetailId");

                if (clientDA.UpdateBusinessDetails(clientBizObj, updateQuery.ToString()))
                {
                    return(true);
                }
                else
                {
                    throw new Exception("Some error occured while saving business data to DB");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e){
     ClientBusiness clientBusiness = new ClientBusiness();
     if (IsPostBack){
         List<Client> client = clientBusiness.selectClient();
         this.nameAttendant = DropDownList1.SelectedItem.ToString();
         foreach (Client clientActual in client){
             if (nameAttendant.Equals("Name: " + clientActual.name + " Mail:" + clientActual.mail + " Password:"******" Card:" + clientActual.card)){
                 this.mail = clientActual.mail;
             }//End if (nameAttendant.Equals("Name: " + clientActual.name + " Mail:" + clientActual.mail + " Password:"******" Card:" + clientActual.card))
         }//End foreach (Client clientActual in client)
     }else{
         DropDownList1.Items.Clear();
         DropDownList1.Items.Add("Unselected");
         List<Client> client = clientBusiness.selectClient();
         foreach (var item in client){
             DropDownList1.Items.Add("Name: " + item.name + " Mail:" + item.mail + " Password:"******" Card:" + item.card);
         }//End foreach  (var item in client)
         this.nameAttendant = DropDownList1.SelectedItem.ToString();
         foreach (Client clientActual in client){
             if (nameAttendant.Equals("Name: " + clientActual.name + " Mail:" + clientActual.mail + " Password:"******" Card:" + clientActual.card)){
                 this.mail = clientActual.mail;
             }//End if (nameAttendant.Equals("Name: " + clientActual.name + " Mail:" + clientActual.mail + " Password:"******" Card:" + clientActual.card))
         }//End foreach (Client clientActual in client)
     }//End if-else(IsPostBack)
 }//End Page_Load
Exemplo n.º 4
0
        public ActionResult Index()
        {
            string orderLevel = "0";
            string taskLevel  = "0";

            if (Session["ClientManager"] == null)
            {
                return(Redirect("/Home/Login"));
            }
            else
            {
                var currentUser = (IntFactoryEntity.Users)Session["ClientManager"];

                if (currentUser.Client.GuideStep != 0)
                {
                    return(Redirect("/Default/Index"));
                }

                var client = ClientBusiness.GetClientDetail(currentUser.ClientID);
                ViewBag.RemainDay  = Math.Ceiling((client.EndTime - DateTime.Now).TotalDays);
                ViewBag.RemainDate = client.EndTime.Date.ToString("yyyy-MM-dd");

                ViewBag.BuyPeople = client.UserQuantity;
                ViewBag.UsePeople = OrganizationBusiness.GetUsers(client.ClientID).FindAll(m => m.Status != 9).Count;

                if (currentUser.Role != null)
                {
                    //所有订单
                    if (ExpandClass.IsExistMenu("102010300"))
                    {
                        orderLevel = "-1";
                    }
                    else if (ExpandClass.IsExistMenu("102010601") || ExpandClass.IsExistMenu("102010701") || ExpandClass.IsExistMenu("102010801"))
                    {
                        orderLevel = "-1";
                    }
                    else if (ExpandClass.IsExistMenu("102010600") || ExpandClass.IsExistMenu("102010700") || ExpandClass.IsExistMenu("102010800"))
                    {
                        orderLevel = "1";
                    }

                    //所有任务
                    if (ExpandClass.IsExistMenu("109010200"))
                    {
                        taskLevel = "-1";
                    }
                    else
                    {
                        taskLevel = "1";
                    }
                }
                ViewBag.OrderMarks = SystemBusiness.BaseBusiness.GetLableColor(currentUser.ClientID, EnumMarkType.Orders);
                ViewBag.TaskMarks  = SystemBusiness.BaseBusiness.GetLableColor(currentUser.ClientID, EnumMarkType.Tasks);
                ViewBag.UserID     = currentUser.UserID;
                ViewBag.orderLevel = orderLevel;
                ViewBag.taskLevel  = taskLevel;
            }

            return(View());
        }
Exemplo n.º 5
0
        //微信账户注册
        public ActionResult WinXinRegisterMember()
        {
            string operateip = Common.Common.GetRequestIP();
            int    result;

            if (Session["WeiXinTokenInfo"] != null)
            {
                string   tokenInfo = Session["WeiXinTokenInfo"].ToString();
                string[] tokenArr  = tokenInfo.Split('|');
                if (tokenArr.Length == 3)
                {
                    string access_token = tokenArr[0];
                    string openid       = tokenArr[1];
                    var    memberResult = WeiXin.Sdk.Passport.GetUserInfo(access_token, openid);

                    string userid   = "";
                    var    clientid = ClientBusiness.InsertClient(EnumRegisterType.WeiXin, EnumAccountType.WeiXin, memberResult.unionid, "", memberResult.nickname, memberResult.nickname,
                                                                  "", "", "", "", "", "", "", "", out result, out userid);

                    if (!string.IsNullOrEmpty(clientid))
                    {
                        var current = OrganizationBusiness.GetUserByOtherAccount(EnumAccountType.WeiXin, memberResult.unionid, operateip);
                        Session.Remove("WeiXinTokenInfo");
                        Session["ClientManager"] = current;

                        return(Redirect("/Home/Index"));
                    }
                }
            }
            return(Redirect("/Home/Login"));
        }
Exemplo n.º 6
0
        public void Setup()
        {
            var data = new List <Book> //Books
            {
                new Book {
                    Title = "AAA", ClientId = 2, DateOfReturn = DateTime.Today.AddDays(15)
                },
                new Book {
                    Title = "BBB", DateOfReturn = DateTime.Today, IsAvailable = true
                },
                new Book {
                    Title = "CCC", ClientId = 2, DateOfReturn = DateTime.Today
                },
            }.AsQueryable();

            Mock <DbSet <Book> > mockDBSetBooks = new Mock <DbSet <Book> >();

            mockDBSetBooks.As <IQueryable <Book> >().Setup(m => m.Provider).Returns(data.Provider);
            mockDBSetBooks.As <IQueryable <Book> >().Setup(m => m.Expression).Returns(data.Expression);
            mockDBSetBooks.As <IQueryable <Book> >().Setup(m => m.ElementType).Returns(data.ElementType);
            mockDBSetBooks.As <IQueryable <Book> >().Setup(m => m.GetEnumerator()).Returns(data.GetEnumerator());

            mockDBSetBooks.Setup(m => m.Find(2)).Returns(new Book()
            {
                Id = 2
            });                                                                  //Sets up Find method for Case 2


            var data2 = new List <Client> //Clients
            {
                new Client {
                    Id = 1, FirstName = "Alan"
                },
                new Client {
                    Id = 2, FirstName = "Bob"
                },
                new Client {
                    Id = 3, FirstName = "Jefrey"
                },
            }.AsQueryable();

            mockDBSetClients = new Mock <DbSet <Client> >();

            mockDBSetClients.As <IQueryable <Client> >().Setup(m => m.Provider).Returns(data2.Provider);
            mockDBSetClients.As <IQueryable <Client> >().Setup(m => m.Expression).Returns(data2.Expression);
            mockDBSetClients.As <IQueryable <Client> >().Setup(m => m.ElementType).Returns(data2.ElementType);
            mockDBSetClients.As <IQueryable <Client> >().Setup(m => m.GetEnumerator()).Returns(data2.GetEnumerator());

            mockDBSetClients.Setup(m => m.Find(2)).Returns(new Client()
            {
                Id = 2
            });                                                                      //Sets up Find method for Case 2

            mockContext = new Mock <LibraryContext>();
            mockContext.Setup(c => c.Books).Returns(mockDBSetBooks.Object);
            mockContext.Setup(c => c.Clients).Returns(mockDBSetClients.Object);


            clientBusiness = new ClientBusiness(mockContext.Object);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 添加客户端
        /// </summary>
        /// <param name="client"></param>
        /// <returns></returns>
        public JsonResult SaveClient(string client, string loginName)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            Clients model = serializer.Deserialize <Clients>(client);
            int     result;

            if (string.IsNullOrEmpty(model.ClientID))

            {
                string clientid = ClientBusiness.InsertClient(model, loginName, loginName, CurrentUser.UserID, out result);
                JsonDictionary.Add("Result", result);
                JsonDictionary.Add("ClientID", clientid);
            }
            else
            {
                bool flag = ClientBusiness.UpdateClient(model, CurrentUser.UserID);

                JsonDictionary.Add("Result", flag?1:0);
            }

            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Exemplo n.º 8
0
        /// <summary>
        /// 添加客户端
        /// </summary>
        /// <param name="client"></param>
        /// <returns></returns>
        public JsonResult SaveClient(string client, string loginName)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            Clients model = serializer.Deserialize <Clients>(client);
            int     result;
            string  userid = "";

            if (string.IsNullOrEmpty(model.ClientID))
            {
                string clientid = ClientBusiness.InsertClient(EnumRegisterType.Manage, EnumAccountType.UserName, loginName, loginName, model.CompanyName, model.ContactName, model.MobilePhone, "", "",
                                                              model.CityCode, model.Address, model.Description, "", CurrentUser.UserID, out result, out userid);
                JsonDictionary.Add("Result", result);
                JsonDictionary.Add("ClientID", clientid);
            }
            else
            {
                bool flag = ClientBusiness.UpdateClient(model, CurrentUser.UserID);

                JsonDictionary.Add("Result", flag?1:0);
            }

            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Exemplo n.º 9
0
 public bool SaveLogo(ClientBusiness clientObj, HttpPostedFileBase fileBase)
 {
     try
     {
         string        logoDir          = this.GetFullLogoDirectory(clientObj.ClientId);
         string        logoFileFullPath = Path.Combine(logoDir, Path.GetFileName(fileBase.FileName));
         DirectoryInfo di = new DirectoryInfo(logoDir);
         if (!di.Exists)
         {
             di.Create();
         }
         else
         {
             foreach (var item in di.GetFiles())
             {
                 item.Delete();
             }
         }
         fileBase.SaveAs(logoFileFullPath);
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 10
0
        public int LoginClient(string mail, string pass)
        {
            ClientBusiness cb = new ClientBusiness();

            return(cb.loginClient(mail, pass));
            // verify = cb.s
        }//End LoginClient
Exemplo n.º 11
0
        public string registerSale(string idClient, string phonesQuantities, string total, string key)
        {
            EncryptionMethods em     = new EncryptionMethods();
            string            conn   = WebConfigurationManager.ConnectionStrings["KeggPhonesConnectionString"].ToString();
            ClientBusiness    cb     = new ClientBusiness(conn);
            SaleBusiness      sb     = new SaleBusiness(conn);
            PhoneSaleBusiness psb    = new PhoneSaleBusiness(conn);
            PhoneBusiness     pb     = new PhoneBusiness(conn);
            Client            client = cb.getClientById(Int32.Parse(em.decrypting(idClient, key)));
            Sale sale = new Sale(0, client, Int32.Parse(em.decrypting(total, key)), DateTime.Today.ToString());
            int  r    = sb.insertSale(sale);

            sale.IdSale = r;
            string phonesQ = em.decrypting(phonesQuantities, key);

            string[] phones = phonesQ.Split('#');
            for (int i = 0; i < phones.Length; i++)
            {
                string[]  data  = phones[i].Split(';');
                Phone     phone = pb.getPhoneById(Int32.Parse(data[0]));
                PhoneSale ps    = new PhoneSale(0, phone, sale, Int32.Parse(data[1]));
                psb.insertPhoneSale(ps);
            }
            string response = "1";

            return(em.encrypt(response, key));
        }
Exemplo n.º 12
0
        /// <summary>
        /// 审核通过客户订单
        /// </summary>
        /// <param name="id"></param>
        /// <param name="agentID"></param>
        /// <returns></returns>
        public JsonResult PayOrderAndAuthorizeClient(string id)
        {
            //订单支付及后台客户授权
            ClientOrder order = ClientOrderBusiness.GetClientOrderInfo(id);

            if (order.Status == 0)
            {
                bool flag = ClientOrderBusiness.PayOrderAndAuthorizeClient(id, CurrentUser.UserID, -1, EnumOrderPayType.Cash);
                JsonDictionary.Add("Result", flag ? 1 : 0);

                if (flag)
                {
                    ClientBusiness.UpdateClientCache(order.ClientID);
                    ClearClientCache(order.ClientID);
                }
            }
            else
            {
                JsonDictionary.Add("Result", order.Status == 1 ? 1001 : 1002);
            }
            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Exemplo n.º 13
0
        public ActionResult UploadGalleryImages(ClientBusiness clientVMObj, string currentStep, HttpPostedFileBase[] fileBaseList)
        {
            try
            {
                if (ControllerHelper.SaveGalleryImages(clientVMObj, fileBaseList))
                {
                    if (BusinessBAObject.UploadGallery(clientVMObj, ControllerHelper.GetFileNames(fileBaseList)))
                    {
                        ViewData["StartStepNum"] = (Convert.ToInt32(currentStep) + 1).ToString();
                    }
                    else
                    {
                        // delete files
                        throw new Exception("Error while updating DB. Please try again!");
                    }
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", "Some error occurred");
                ModelState.AddModelError("e", ex);
                ViewData["StartStepNum"] = currentStep;
            }

            fileUploadCount = 0;
            return(View("Index"));
        }
Exemplo n.º 14
0
        public bool AddLogoDetails(ClientBusiness clientObj, string updateQuery)
        {
            try
            {
                using (SqlConnection con = new SqlConnection(ConnectionStr))
                {
                    con.Open();
                    SqlCommand cmd = new SqlCommand(updateQuery, con);
                    cmd.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@ClientBusinessDetailId", SqlDbType = SqlDbType.Int, Value = clientObj.BizId
                    });
                    cmd.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@LogoPath", SqlDbType = SqlDbType.VarChar, Value = clientObj.BizLogoPath, Size = 750
                    });

                    cmd.ExecuteNonQuery();
                    return(true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        private async Task UpdateTempData(int userID)
        {
            NsusersT userContext = await _context.NsusersT.Include(entity => entity.NsapplicationsT).SingleAsync(entity => entity.Id == userID);

            UserModel userModel = ClientBusiness.MapUserModel(userContext);

            TempData[Constants.StateKey.UserModel] = JsonConvert.SerializeObject(userModel);
        }
Exemplo n.º 16
0
        public void btnCheckoutClicked(object sender, EventArgs e)
        {
            DataTable items = new DataTable();

            items.Columns.Add("cod_item");
            items.Columns.Add("quantity");

            foreach (TextBox box in textboxes)
            {
                int code     = int.Parse(box.ID);
                int quantity = 0;

                try
                {
                    quantity = int.Parse(box.Text);
                }
                catch (Exception)
                {
                    messageHolder.Controls.Add(
                        new LiteralControl(Message.errorMessage("Las cantidades deben ser valores numericos")
                                           ));
                    return;
                }

                if (quantity > 0)
                {
                    items.Rows.Add(code, quantity);
                }
            }

            if (items.Rows.Count == 0)
            {
                messageHolder.Controls.Add(
                    new LiteralControl(Message.errorMessage("No hay itemes seleccionados a comprar")
                                       ));
                return;
            }

            String         connectionString = WebConfigurationManager.ConnectionStrings["DBLENGUAJES"].ToString();
            ClientBusiness clientBusiness   = new ClientBusiness(connectionString);

            String result = clientBusiness.doPurchase(items, Session["name"].ToString(), Util.getAppDate());

            messageHolder.Controls.Clear();

            if (result == "OK")
            {
                cartHolder.Controls.Clear();
                messageHolder.Controls.Add(
                    new LiteralControl(Message.successMessage("<h2>La compra fue realizada con exito<h2>"))
                    );
            }
            else
            {
                messageHolder.Controls.Add(new LiteralControl(Message.errorMessage(result)));
            }
        }
Exemplo n.º 17
0
        public void TestUpdateLocalFiles()
        {
            DateTime now            = DateTime.Now;
            string   fileAdded      = Path.Combine(TESTING_PATH, GROUP1, Path.GetRandomFileName());
            Revision revisionCreate = new Revision()
            {
                File = new ShareLibrary.Models.FileInfo
                {
                    Name = Path.GetFileName(fileAdded),
                    LastModificationDate = now,
                    CreationDate         = now
                },
                GroupName = GROUP1,
                Action    = Action.Create,
                Data      = new byte[1]
            };
            string   fileDeleted    = Path.Combine(TESTING_PATH, GROUP1, Path.GetRandomFileName());
            Revision revisionDelete = new Revision()
            {
                File = new ShareLibrary.Models.FileInfo
                {
                    Name = Path.GetFileName(fileDeleted),
                    LastModificationDate = now,
                    CreationDate         = now
                },
                GroupName = GROUP1,
                Action    = ShareLibrary.Models.Action.Delete
            };
            string   fileModifed     = Path.Combine(TESTING_PATH, GROUP1, Path.GetRandomFileName());
            Revision revisionModfied = new Revision()
            {
                File = new ShareLibrary.Models.FileInfo
                {
                    Name = Path.GetFileName(fileModifed),
                    LastModificationDate = now,
                    CreationDate         = now
                },
                GroupName = GROUP1,
                Action    = Action.Modify,
                Data      = new byte[1]
            };

            File.Create(fileModifed).Close();
            ClientBusiness client = new ClientBusiness(TESTING_PATH);

            client.UpdateLocalFiles(new List <Revision>()
            {
                revisionDelete, revisionCreate, revisionModfied
            });

            Assert.IsFalse(File.Exists(fileDeleted));
            Assert.AreEqual(now, File.GetLastWriteTime(fileModifed));
            Assert.AreEqual(now, File.GetCreationTime(fileAdded));
            File.Delete(fileModifed);
            File.Delete(fileAdded);
        }
Exemplo n.º 18
0
        public string getClient(string nameUser, string key)
        {
            string            conn     = WebConfigurationManager.ConnectionStrings["KeggPhonesConnectionString"].ToString();
            ClientBusiness    cb       = new ClientBusiness(conn);
            EncryptionMethods em       = new EncryptionMethods();
            Client            client   = cb.getClientByUserName(em.decrypting(nameUser, key));
            string            response = client.IdUser + ";" + client.Name + ";" + client.LastName_1 + ";" + client.LastName_2 + ";" + client.PasswordUser + ";" + client.Email + ";" + client.NumberCard + ";" +
                                         client.AddressDirection + ";" + client.PostalCode + ";" + client.SvcCard;

            return(em.encrypt(response, key));
        }
Exemplo n.º 19
0
        public JsonResult DeleteClient(string id)
        {
            bool flag = ClientBusiness.DeleteClient(id);

            JsonDictionary.Add("Result", flag?1:0);
            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Exemplo n.º 20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            String         connectionString = WebConfigurationManager.ConnectionStrings["DBLENGUAJES"].ToString();
            ClientBusiness clientBusiness   = new ClientBusiness(connectionString);

            String clientName = (String)Session["name"];

            LinkedList <Item> cart = clientBusiness.getCart(clientName, Util.getAppDate());

            if (cart.Count == 0)
            {
                cartHolder.Controls.Add(new LiteralControl("<h2 class=\"text-center bg-warning\">"));
                cartHolder.Controls.Add(new LiteralControl("No hay articulos en el carrito"));
                cartHolder.Controls.Add(new LiteralControl("<h2>"));
                return;
            }

            cartHolder.Controls.Add(new LiteralControl("<table class=\"table table-hover text-center\">"));

            cartHolder.Controls.Add(new LiteralControl(MyControl.TableHeader("Nombre")));
            cartHolder.Controls.Add(new LiteralControl(MyControl.TableHeader("Precio")));
            cartHolder.Controls.Add(new LiteralControl(
                                        MyControl.TableHeader("Cantidad a comprar")
                                        ));

            foreach (Item item in cart)
            {
                cartHolder.Controls.Add(new LiteralControl("<tr>"));

                cartHolder.Controls.Add(new LiteralControl(MyControl.TableItem(item.Name)));
                cartHolder.Controls.Add(new LiteralControl(MyControl.TableItem("¢" + item.Price.ToString())));


                TextBox tbQuantity = new TextBox();
                tbQuantity.ID       = item.Code.ToString();
                tbQuantity.TextMode = TextBoxMode.Number;
                tbQuantity.Text     = "0";
                tbQuantity.CssClass = "form-control";

                this.textboxes.AddLast(tbQuantity);

                cartHolder.Controls.Add(new LiteralControl("<td>"));
                cartHolder.Controls.Add(tbQuantity);
                cartHolder.Controls.Add(new LiteralControl("</td>"));

                cartHolder.Controls.Add(new LiteralControl("</tr>"));
            }

            cartHolder.Controls.Add(new LiteralControl("</table>"));

            cartHolder.Controls.Add(new LiteralControl("\n <button type=\"button\" class=\"btn btn-primary\" data-target=\"#checkModal\" data-toggle=\"modal\">"));
            cartHolder.Controls.Add(new LiteralControl("Comprar"));
            cartHolder.Controls.Add(new LiteralControl("</button>"));
        }
Exemplo n.º 21
0
        public ActionResult UseExpired()
        {
            if (Session["ClientManager"] != null)
            {
                var currentUser = (IntFactoryEntity.Users)Session["ClientManager"];
                var client      = ClientBusiness.GetClientDetail(currentUser.ClientID);
                ViewBag.EndTime = client.EndTime.ToString("yyyy-MM-dd");
            }

            return(View());
        }
Exemplo n.º 22
0
        public string deleteClient(string idClient, string key)
        {
            EncryptionMethods em   = new EncryptionMethods();
            string            conn = WebConfigurationManager.ConnectionStrings["KeggPhonesConnectionString"].ToString();
            ClientBusiness    cb   = new ClientBusiness(conn);
            int    t        = Int32.Parse(em.decrypting(idClient + "", key));
            int    r        = cb.deleteClient(t);
            string response = em.encrypt(r + "", key);

            return(response);
        }
Exemplo n.º 23
0
 // DELETE: api/Client/5
 public void Delete(int id)
 {
     try
     {
         ClientBusiness business = new ClientBusiness();
         business.Delete(id);
     }
     catch (System.Exception)
     {
         throw;
     }
 }
Exemplo n.º 24
0
 // PUT: api/Client/5
 public void Put(int id, [FromBody] Client client)
 {
     try
     {
         ClientBusiness business = new ClientBusiness();
         business.Update(client);
     }
     catch (System.Exception)
     {
         throw;
     }
 }
Exemplo n.º 25
0
 // POST: api/Client
 public void Post([FromBody] Client client)
 {
     try
     {
         ClientBusiness business = new ClientBusiness();
         business.Create(client);
     }
     catch (System.Exception)
     {
         throw;
     }
 }
Exemplo n.º 26
0
 // GET: api/Client/5
 public IHttpActionResult Get(int id)
 {
     try
     {
         ClientBusiness business = new ClientBusiness();
         return(this.Content(HttpStatusCode.OK, business.Get(id)));
     }
     catch (System.Exception)
     {
         throw;
     }
 }
Exemplo n.º 27
0
        public JsonResult GetClientDetail(string id)
        {
            var item = ClientBusiness.GetClientDetail(id);

            JsonDictionary.Add("Item", item);
            JsonDictionary.Add("Result", 1);
            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Exemplo n.º 28
0
        public bool DeleteLogoOnDBUpdateFail(ClientBusiness clientObj, HttpPostedFileBase fileBase)
        {
            string   logoDir          = this.GetFullLogoDirectory(clientObj.ClientId);
            string   logoFileFullPath = Path.Combine(logoDir, Path.GetFileName(fileBase.FileName));
            FileInfo fi = new FileInfo(logoFileFullPath);

            if (fi.Exists)
            {
                fi.Delete();
            }
            return(true);
        }
Exemplo n.º 29
0
        public JsonResult SetClientCategory(string ids)
        {
            int guideStep = ClientBusiness.SetClientCategory(ids, CurrentUser.UserID, CurrentUser.ClientID);

            JsonDictionary.Add("value", guideStep);
            CurrentUser.Client.GuideStep = guideStep;
            return(new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Exemplo n.º 30
0
        public ActionResult OrderDetail(string id)
        {
            var model = OrdersBusiness.BaseBusiness.GetOrderByID(id, CurrentUser.ClientID);

            if (model == null || string.IsNullOrEmpty(model.OrderID))
            {
                return(Redirect("/Orders/Orders"));
            }

            if (model.OrderType == 2)
            {
                model.OrderAttrs = OrdersBusiness.BaseBusiness.GetOrderArrrsByOrderID(model.OriginalID);
            }

            model.IsSelf = model.ClientID == CurrentUser.ClientID;

            if (model.IsSelf && !string.IsNullOrEmpty(model.EntrustClientID))
            {
                ViewBag.Client = ClientBusiness.GetClientDetail(model.EntrustClientID);
            }
            else if (!model.IsSelf)
            {
                ViewBag.Client = ClientBusiness.GetClientDetail(model.ClientID);
            }
            ViewBag.Model = model;
            ProcessCategoryEntity item = SystemBusiness.BaseBusiness.GetProcessCategoryByID(model.BigCategoryID);

            ViewBag.Tabs    = item.CategoryItems.Where(m => m.Type == 1 && m.OrderType == model.OrderType).ToList();
            ViewBag.Modules = item.CategoryItems.Where(m => m.Type == 3).ToList();
            ViewBag.list    = SystemBusiness.BaseBusiness.GetLableColor(CurrentUser.ClientID, EnumMarkType.Orders).ToList();

            if (model.IsSelf && string.IsNullOrEmpty(model.EntrustClientID))
            {
                ViewBag.IsDoClient = true;
            }
            else if (!model.IsSelf && !string.IsNullOrEmpty(model.EntrustClientID))
            {
                ViewBag.IsDoClient = true;
            }
            else
            {
                ViewBag.IsDoClient = false;
            }

            if (model.OrderType == 1)
            {
                return(View());
            }
            else
            {
                return(View("OrderDetailDH"));
            }
        }