public JsonResult GetSubProductDetails(string Type)
        {
            Common            common       = new Common();
            Studio365Entities Entity       = new Studio365Entities();
            ResponseData      responseData = new ResponseData();

            try
            {
                responseData.ReturnType = "";
                responseData.Message    = common.SuccessMessage;
                Guid lookupID = Guid.NewGuid();
                if (Type == "Studio")
                {
                    lookupID = Guid.Parse((from l in Entity.LookupTypes
                                           where l.LookupType1 == common.lookupSubProduct
                                           select l.LookupID.ToString()).FirstOrDefault());
                    responseData.Content = (from lp in Entity.Lookups where lp.LookupID == lookupID select lp.Lookups).ToList();
                }
                else
                {
                    lookupID = Guid.Parse((from l in Entity.LookupTypes
                                           where l.LookupType1 == common.lookupMarriageSubProduct
                                           select l.LookupID.ToString()).FirstOrDefault());
                    responseData.Content = (from lp in Entity.Lookups where lp.LookupID == lookupID select lp.Lookups).ToList();
                }
            }
            catch (Exception ex)
            {
            }
            return(Json(responseData, JsonRequestBehavior.AllowGet));
        }
        public JsonResult AddCustomerDetails(Customer customer)
        {
            Common            common       = new Common();
            Studio365Entities Entity       = new Studio365Entities();
            ResponseData      responseData = new ResponseData()
            {
                ReturnType = common.ReturnTypeMessage,
            };

            try
            {
                int existingCustomer = (from c in Entity.Customers where c.Mobile == customer.Mobile select c).Count();
                if (existingCustomer == 0)
                {
                    Entity.Customers.Add(customer);
                    Entity.SaveChanges();
                    responseData.Message = common.SuccessMessage;
                }
                else
                {
                    responseData.Message = "Customer Already Available..!";
                }
            }
            catch (Exception ex)
            {
            }
            return(Json(responseData, JsonRequestBehavior.AllowGet));
        }
        public JsonResult AddUser(UsersDetail user)
        {
            Common            common       = new Common();
            Studio365Entities Entity       = new Studio365Entities();
            ResponseData      responseData = new ResponseData()
            {
                ReturnType = common.ReturnTypeMessage
            };

            try
            {
                int existing = (from u in Entity.UsersDetails where u.MobileNumber == user.MobileNumber select u).Count();
                if (existing == 0)
                {
                    Entity.UsersDetails.Add(user);
                    Entity.SaveChanges();
                    responseData.Message = common.SuccessMessage;
                }
                else
                {
                    responseData.Message = "Mobile Number Already Present";
                }
            }
            catch (Exception ex)
            {
                responseData.Message = ex.Message.ToString();
            }
            return(Json(responseData, JsonRequestBehavior.AllowGet));
        }
        public JsonResult AddStudioDetails(studioDetails studioDetails)
        {
            Common            common       = new Common();
            Studio365Entities Entity       = new Studio365Entities();
            commonDetail      commonDetail = new commonDetail();
            ResponseData      responseData = new ResponseData()
            {
                ReturnType = common.ReturnTypeMessage,
            };

            try
            {
                int count = (from c in Entity.commonDetails where c.Name == common.studioEntry select c).Count();
                if (count > 0)
                {
                    commonDetail             = (from c in Entity.commonDetails where c.Name == common.studioEntry select c).FirstOrDefault();
                    commonDetail.ItemDetails = JsonConvert.SerializeObject(studioDetails);
                }
                else
                {
                    commonDetail.Name        = common.studioEntry;
                    commonDetail.ItemDetails = JsonConvert.SerializeObject(studioDetails);
                    Entity.commonDetails.Add(commonDetail);
                }
                Entity.SaveChanges();
                responseData.Message = common.SuccessMessage;
            }
            catch (Exception ex)
            {
                responseData.Message = common.FailureMessage;
            }
            return(Json(responseData, JsonRequestBehavior.AllowGet));
        }
Exemple #5
0
        public JsonResult AddDenomination(RupeeDetails rupeeDetails, string UserID)
        {
            Common            common       = new Common();
            Studio365Entities Entity       = new Studio365Entities();
            ResponseData      responseData = new ResponseData()
            {
                Message    = common.SuccessMessage,
                ReturnType = common.ReturnTypeMessage
            };

            try
            {
                int denominationCount = (from d in Entity.Denominations where d.Date == DateTime.Now select d).Count();
                if (denominationCount == 0)
                {
                    Denomination denomination = new Denomination()
                    {
                        RupeeCounts = JsonConvert.SerializeObject(rupeeDetails),
                        userID      = UserID,
                        Date        = DateTime.Now
                    };
                    Entity.Denominations.Add(denomination);
                    Entity.SaveChanges();
                }
                else
                {
                    responseData.Message = common.duplicateDenomination;
                }
            }
            catch (Exception ex)
            {
                responseData.Message = ex.Message.ToString();
            }
            return(Json(responseData, JsonRequestBehavior.AllowGet));
        }
Exemple #6
0
        public JsonResult AddHistoryDetails(string BillNo, int Amount, string EmployeeID)
        {
            Common            common       = new Common();
            Studio365Entities Entity       = new Studio365Entities();
            ResponseData      responseData = new ResponseData()
            {
                ReturnType = common.ReturnTypeMessage
            };

            try
            {
                History history = new History()
                {
                    Amount     = Amount,
                    BillNo     = BillNo,
                    Date       = DateTime.Now,
                    EmployeeID = EmployeeID
                };
                Entity.Histories.Add(history);
                Entity.SaveChanges();
                responseData.Message = common.SuccessMessage;
            }
            catch (Exception ex)
            {
                responseData.Message = ex.Message.ToString();
            }
            return(Json(responseData, JsonRequestBehavior.AllowGet));
        }
        public JsonResult AddPackageDetails(List <ProductSubProductItems> lstProductSubProductItems, string PackageName)
        {
            Common            common       = new Common();
            Studio365Entities Entity       = new Studio365Entities();
            ResponseData      responseData = new ResponseData()
            {
                ReturnType = common.SuccessMessage
            };

            try
            {
                PackageConfiguration package = new PackageConfiguration()
                {
                    PackageName    = PackageName,
                    PackageDetails = JsonConvert.SerializeObject(lstProductSubProductItems),
                    Date           = DateTime.Now,
                    EmployeeID     = "",
                };
                Entity.PackageConfigurations.Add(package);
                Entity.SaveChanges();
                responseData.Message = common.SuccessMessage;
            }
            catch (Exception ex)
            {
                responseData.Message = ex.Message.ToString();
            }
            return(Json(responseData, JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetUserDetails()
        {
            Studio365Entities  Entity   = new Studio365Entities();
            List <UsersDetail> lstUsers = new List <UsersDetail>();

            try
            {
                lstUsers = (from u in Entity.UsersDetails select u).ToList();
            }
            catch (Exception ex)
            {
            }
            return(Json(lstUsers, JsonRequestBehavior.AllowGet));
        }
Exemple #9
0
        public JsonResult GetDenominations()
        {
            Common              common        = new Common();
            Studio365Entities   Entity        = new Studio365Entities();
            List <Denomination> denominations = new List <Denomination>();

            try
            {
                denominations = (from d in Entity.Denominations select d).ToList();
            }
            catch (Exception ex)
            {
            }
            return(Json(denominations, JsonRequestBehavior.AllowGet));
        }
Exemple #10
0
        public JsonResult GetTransactionDetails(string billNo)
        {
            Studio365Entities Entity     = new Studio365Entities();
            Common            common     = new Common();
            List <History>    lstHistory = new List <History>();

            try
            {
                lstHistory = (from h in Entity.Histories where h.BillNo == billNo select h).ToList();
            }
            catch (Exception ex)
            {
            }
            return(Json(lstHistory, JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetStudioDetails()
        {
            Common            common       = new Common();
            Studio365Entities Entity       = new Studio365Entities();
            commonDetail      commonDetail = new commonDetail();

            try
            {
                commonDetail = (from c in Entity.commonDetails where c.Name == common.studioEntry select c).FirstOrDefault();
            }
            catch (Exception ex)
            {
            }
            return(Json(commonDetail, JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetCustomerDetails()
        {
            Common            common      = new Common();
            Studio365Entities Entity      = new Studio365Entities();
            List <Customer>   lstCustomer = new List <Customer>();

            try
            {
                lstCustomer = (from c in Entity.Customers select c).ToList();
            }
            catch (Exception ex)
            {
            }
            return(Json(lstCustomer, JsonRequestBehavior.AllowGet));
        }
Exemple #13
0
        public JsonResult GetCustomerName(string mobileNumber)
        {
            Studio365Entities Entity       = new Studio365Entities();
            Common            common       = new Common();
            string            customerName = string.Empty;

            try
            {
                customerName = (from c in Entity.Customers where c.Mobile == mobileNumber select c.Name).FirstOrDefault();
            }
            catch (Exception ex)
            {
            }

            return(Json(customerName, JsonRequestBehavior.AllowGet));
        }
Exemple #14
0
        public JsonResult GetSubProductDetails(string Product)
        {
            Studio365Entities Entity  = new Studio365Entities();
            Common            common  = new Common();
            List <Master>     masters = new List <Master>();

            try
            {
                masters = (from m in Entity.Masters where m.ProductTypes == Product select m).ToList();
            }
            catch (Exception ex)
            {
            }

            return(Json(masters, JsonRequestBehavior.AllowGet));
        }
Exemple #15
0
        public JsonResult GetBillNo()
        {
            Studio365Entities Entity = new Studio365Entities();
            Common            common = new Common();
            int billNo = 1;

            try
            {
                billNo = (from o in Entity.Orders select o).Count();
                billNo = (billNo == 0) ? 1 : ++billNo;
            }
            catch (Exception ex)
            {
            }
            return(Json(billNo, JsonRequestBehavior.AllowGet));
        }
Exemple #16
0
        public JsonResult GetOrdersDetails()
        {
            Studio365Entities Entity = new Studio365Entities();
            Common            common = new Common();
            List <Order>      order  = new List <Order>();

            try
            {
                order = (from o in Entity.Orders select o).ToList();
            }
            catch (Exception ex)
            {
            }

            return(Json(order, JsonRequestBehavior.AllowGet));
        }
        public JsonResult AddNewProduct(string Product, string Type)
        {
            Common            common       = new Common();
            Studio365Entities Entity       = new Studio365Entities();
            ResponseData      responseData = new ResponseData()
            {
                ReturnType = common.ReturnTypeMessage,
                Content    = new List <string>(),
            };

            try
            {
                Lookup lookup = new Lookup();
                if (Type == "Studio")
                {
                    lookup.LookupID = Guid.Parse((from lookupType in Entity.LookupTypes
                                                  where lookupType.LookupType1 == common.lookupProduct
                                                  select lookupType.LookupID.ToString()).FirstOrDefault());
                }
                else
                {
                    lookup.LookupID = Guid.Parse((from lookupType in Entity.LookupTypes
                                                  where lookupType.LookupType1 == common.lookupMarriageProduct
                                                  select lookupType.LookupID.ToString()).FirstOrDefault());
                }

                lookup.Lookups = Product;
                int existing = (from l in Entity.Lookups where l.LookupID == lookup.LookupID && l.Lookups == Product select l).Count();
                if (existing == 0)
                {
                    Entity.Lookups.Add(lookup);
                    Entity.SaveChanges();
                    responseData.Message = common.SuccessMessage;
                }
                else
                {
                    responseData.Message = "Product Already Existing";
                }
                responseData.Content = (from l in Entity.Lookups where l.LookupID == lookup.LookupID select l.Lookups).ToList();
            }
            catch (Exception ex)
            {
                responseData.Message = ex.Message.ToString();
            }

            return(Json(responseData, JsonRequestBehavior.AllowGet)); //responseData;
        }
Exemple #18
0
        public JsonResult AddBillDetails(List <Common.orderDetails> orderDetails, string BillNo, string TotalAmount)
        {
            //Common.CommonOrderDetails orders = new Common.CommonOrderDetails();
            //orders = orderDetails[0].commonOrderDetails;
            Common            common       = new Common();
            Studio365Entities Entity       = new Studio365Entities();
            ResponseData      responseData = new ResponseData()
            {
                ReturnType = common.ReturnTypeMessage
            };

            try
            {
                Order order = new Order()
                {
                    BillNo         = BillNo,
                    Date           = DateTime.Now,
                    CustomerMobile = orderDetails[0].customerMobile,
                    CustomerName   = orderDetails[0].customerName,
                    AdvanceAmount  = Int32.Parse(orderDetails[0].AdvanceAmount),
                    Discount       = Int32.Parse(orderDetails[0].Discount),
                    Orders         = JsonConvert.SerializeObject(orderDetails),
                    Total          = Int32.Parse(TotalAmount),
                    EmployeeID     = "",
                };
                Entity.Orders.Add(order);
                Entity.SaveChanges();

                //Add Bill History
                AddHistoryDetails(BillNo, Int32.Parse(orderDetails[0].AdvanceAmount), "");

                //Add Customer
                Customer customer = new Customer()
                {
                    Name   = orderDetails[0].customerName,
                    Mobile = orderDetails[0].customerMobile
                };

                CustomerController addCustomer = new CustomerController();
                addCustomer.AddCustomerDetails(customer);
            }
            catch (Exception ex)
            {
                responseData.Message = ex.Message.ToString();
            }
            return(Json(responseData, JsonRequestBehavior.AllowGet));
        }
Exemple #19
0
        public JsonResult GetItemDetails(string product, string subProduct)
        {
            Studio365Entities Entity = new Studio365Entities();
            Common            common = new Common();
            Master            master = new Master();

            try
            {
                master = (from c in Entity.Masters
                          where c.ProductTypes == product && c.ProductSubTypes == subProduct
                          select c).FirstOrDefault();
            }
            catch (Exception ex)
            {
            }

            return(Json(master, JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetMasterDetails(string Type)
        {
            Common            common       = new Common();
            Studio365Entities Entity       = new Studio365Entities();
            List <Master>     lstMaster    = new List <Master>();
            ResponseData      responseData = new ResponseData()
            {
                ReturnType = common.ReturnTypeMessage,
            };

            try
            {
                lstMaster = (from m in Entity.Masters where m.Type == Type select m).ToList();
            }
            catch (Exception ex)
            {
            }
            return(Json(lstMaster, JsonRequestBehavior.AllowGet));
        }
Exemple #21
0
        public JsonResult DeleteDenomination(string Sno)
        {
            Common            common       = new Common();
            Studio365Entities Entity       = new Studio365Entities();
            ResponseData      responseData = new ResponseData()
            {
                ReturnType = common.ReturnTypeMessage
            };

            try
            {
                var denomination = (from d in Entity.Denominations where d.Sno == Int32.Parse(Sno) select d).FirstOrDefault();
                Entity.Denominations.Remove(denomination);
                Entity.SaveChanges();
                responseData.Message = common.SuccessMessageDelete;
            }
            catch (Exception ex)
            {
                responseData.Message = ex.Message.ToString();
            }
            return(Json(responseData, JsonRequestBehavior.AllowGet));
        }
        public JsonResult DeleteMaster(int id)
        {
            Common            common       = new Common();
            Studio365Entities Entity       = new Studio365Entities();
            ResponseData      responseData = new ResponseData()
            {
                ReturnType = common.ReturnTypeMessage,
            };

            try
            {
                var master = (from m in Entity.Masters where m.Sno == id select m).FirstOrDefault();
                Entity.Masters.Remove(master);
                Entity.SaveChanges();

                responseData.Message = common.SuccessMessageDelete;
            }
            catch (Exception ex)
            {
            }
            return(Json(responseData, JsonRequestBehavior.AllowGet));
        }
Exemple #23
0
        public JsonResult GetProductDetails()
        {
            Studio365Entities Entity   = new Studio365Entities();
            Common            common   = new Common();
            List <Lookup>     Products = new List <Lookup>();

            try
            {
                LookupType lookupType = new LookupType();
                lookupType = (from l in Entity.LookupTypes
                              where l.LookupType1 == common.lookupProduct
                              select l).FirstOrDefault();
                Products = (from l in Entity.Lookups
                            where l.LookupID == lookupType.LookupID
                            select l).ToList();
            }
            catch (Exception ex)
            {
            }

            return(Json(Products, JsonRequestBehavior.AllowGet));
        }
        public JsonResult SignIn(string userName, string password)
        {
            Common            common       = new Common();
            Studio365Entities Entity       = new Studio365Entities();
            ResponseData      responseData = new ResponseData()
            {
                ReturnType = common.ReturnTypeMessage,
            };

            try
            {
                int userExist = (from u in Entity.UsersDetails
                                 where u.MobileNumber == userName && u.Password == password
                                 select u).Count();
                if (userExist == 0)
                {
                    responseData.Message = common.loginFailure;
                }
                else
                {
                    responseData.Message = common.loginSuccess;
                    UsersDetail user = (from u in Entity.UsersDetails
                                        where u.MobileNumber == userName && u.Password == password
                                        select u).FirstOrDefault();
                    List <string> lstUser = new List <string>()
                    {
                        user.Name,
                        user.JoinDate.ToString(),
                        user.MobileNumber,
                    };
                    responseData.Content = lstUser;
                }
            }
            catch (Exception ex)
            {
            }
            return(Json(responseData, JsonRequestBehavior.AllowGet));
        }
        public JsonResult AddMasterDetails(Master master, string Type)
        {
            Common       common       = new Common();
            ResponseData responseData = new ResponseData()
            {
                ReturnType = common.ReturnTypeMessage,
            };

            try
            {
                master.Status = common.statusActive;
                master.Type   = Type;
                Studio365Entities entity = new Studio365Entities();
                entity.Masters.Add(master);
                entity.SaveChanges();
                responseData.Message = common.SuccessMessage;
            }
            catch (Exception ex)
            {
                responseData.Message = ex.Message.ToString();
            }

            return(Json(responseData, JsonRequestBehavior.AllowGet));
        }