Ejemplo n.º 1
0
        public int InsertCustomerItemRate(CustomerVsWorkDescriptionRate objCustomerVsWorkRate)
        {
            using (IDbConnection connection = OpenConnection(dataConnection))
            {
                int id = 0;
                foreach (var item in objCustomerVsWorkRate.CustomerVsWorkRateItem)
                {
                    string sql = @"insert  into CustomerVsWorkRate(CustomerId,WorkDescriptionId,FixedRate,CreatedBy,CreatedDate,OrganizationId,isActive) 
                           Values (@CustomerId,@WorkDescriptionId,@FixedRate,@CreatedBy,@CreatedDate,@OrganizationId,1);
                           SELECT CAST(SCOPE_IDENTITY() as int)";

                    //id = connection.Query<int>(sql, objOpeningStock).Single();

                    id = connection.Query <int>(sql, new
                    {
                        CustomerId        = objCustomerVsWorkRate.CustomerId,
                        WorkDescriptionId = item.WorkDescriptionId,
                        FixedRate         = item.FixedRate,
                        CreatedBy         = objCustomerVsWorkRate.CreatedBy,
                        CreatedDate       = objCustomerVsWorkRate.CreatedDate,
                        OrganizationId    = objCustomerVsWorkRate.OrganizationId
                    }).Single();
                    InsertLoginHistory(dataConnection, objCustomerVsWorkRate.CreatedBy, "Update", "Customer Vs Work Rate", id.ToString(), "0");
                }


                return(id);
            }
        }
Ejemplo n.º 2
0
 public int DeleteCustomerItemRate(CustomerVsWorkDescriptionRate objCustomerVsWorkRate)
 {
     using (IDbConnection connection = OpenConnection(dataConnection))
     {
         string sql = @"Delete From  CustomerVsWorkRate  WHERE CustomerId=@CustomerId";
         var    id  = connection.Execute(sql, objCustomerVsWorkRate);
         InsertLoginHistory(dataConnection, objCustomerVsWorkRate.CreatedBy, "Delete", "Customer Vs Work Rate", id.ToString(), "0");
         return(id);
     }
 }
Ejemplo n.º 3
0
        public ActionResult Create()
        {
            FillCustomer();

            CustomerVsWorkDescriptionRate CustomerVsWorkDescriptionRate = new CustomerVsWorkDescriptionRate();

            CustomerVsWorkDescriptionRate.CustomerVsWorkRateItem = new List <CustomerVsWorkRateItem>();
            CustomerVsWorkDescriptionRate.CustomerVsWorkRateItem.Add(new CustomerVsWorkRateItem());

            return(View(CustomerVsWorkDescriptionRate));
        }
Ejemplo n.º 4
0
        public ActionResult Save(CustomerVsWorkDescriptionRate model)
        {
            model.OrganizationId = OrganizationId;
            model.CreatedDate    = System.DateTime.Now;
            model.CreatedBy      = UserID.ToString();
            new CustomerVsWorkRateRepository().DeleteCustomerItemRate(model);
            new CustomerVsWorkRateRepository().InsertCustomerItemRate(model);

            FillCustomer();


            CustomerVsWorkDescriptionRate CustomerVsWorkDescriptionRate = new CustomerVsWorkDescriptionRate();

            CustomerVsWorkDescriptionRate.CustomerVsWorkRateItem = new List <CustomerVsWorkRateItem>();
            CustomerVsWorkDescriptionRate.CustomerVsWorkRateItem.Add(new CustomerVsWorkRateItem());

            TempData["Success"] = "Updated Successfully!";
            //TempData["CustomerId"] = model.CustomerId;
            return(RedirectToAction("Create"));
        }
Ejemplo n.º 5
0
        public ActionResult CustomerItemRateList(int?CustomerId)
        {
            CustomerVsWorkDescriptionRate CustomerVsWorkDescriptionRate = new CustomerVsWorkDescriptionRate();

            CustomerVsWorkDescriptionRate.CustomerVsWorkRateItem = new List <CustomerVsWorkRateItem>();
            var repo = new CustomerVsWorkRateRepository();

            //if (CustomerId == null || CustomerId == 0)
            //{

            //    CustomerVsWorkDescriptionRate.CustomerVsWorkRateItem = repo.GetWorkList().ToList();
            //}
            //else
            //{
            CustomerVsWorkDescriptionRate.CustomerVsWorkRateItem = repo.GetItem(CustomerId ?? 0).ToList();
            //}

            if (CustomerVsWorkDescriptionRate.CustomerVsWorkRateItem.Count == 0)
            {
                CustomerVsWorkDescriptionRate.CustomerVsWorkRateItem = repo.GetWorkList().ToList();
            }
            return(PartialView("CustomerItemRateList", CustomerVsWorkDescriptionRate));
        }