Esempio n. 1
0
 public ActionResult Save(iffsUserOperationTypeMapping userMapping)
 {
     if (userMapping.Id.Equals(0))
     {
         _userMapping.AddNew(userMapping);
     }
     else
     {
         _userMapping.Edit(userMapping);
     }
     return(this.Json(new { success = true, data = "Data has been saved successfully!" }));
 }
Esempio n. 2
0
        public DirectResult Save(iffsPackingMaterialConsumption PackingMaterialConsumption)
        {
            using (var transaction = new TransactionScope((TransactionScopeOption.Required), new TransactionOptions {
                IsolationLevel = IsolationLevel.ReadCommitted
            }))
            {
                _context.Database.Connection.Open();
                _context.Database.CommandTimeout = int.MaxValue;
                try
                {
                    // Request.Params[""]
                    int employeeId = 0;
                    var objUser    = (coreUser)Session[Constants.CurrentUser];
                    if (objUser != null && objUser.EmployeeId != null)
                    {
                        employeeId = (int)objUser.EmployeeId;
                    }
                    if (PackingMaterialConsumption.Id.Equals(0))
                    {
                        //PackingMaterialConsumption.PreparedById = employeeId;
                        //PackingMaterialConsumption.PreparedDate = DateTime.Now;

                        /* ***************************************************
                        * Concurrency controlling scheme using global locking
                        * ***************************************************/

                        //  var objOperationType = _lookup.GetAll((Lookups.LupOperationType)).Where(o => o.Id == PackingMaterialConsumption.Id).FirstOrDefault();
                        CyberErp.Presentation.Iffs.Web.MvcApplication httpapplication = HttpContext.ApplicationInstance as CyberErp.Presentation.Iffs.Web.MvcApplication;
                        httpapplication.Application.Lock();
                        // PackingMaterialConsumption.Number = GetDocumentNumber("PackingMaterialConsumption");//objOperationType.Code + "/" +
                        _PackingMaterialConsumption.AddNew(PackingMaterialConsumption);
                        // UpdateDocumentNumber("PackingMaterialConsumption");
                        httpapplication.Application.UnLock();
                    }
                    else
                    {
                        _PackingMaterialConsumption.Edit(PackingMaterialConsumption);
                    }
                    _context.SaveChanges();
                    transaction.Complete();
                    return(this.Json(new { success = true, HeaderId = PackingMaterialConsumption.Id, data = "Packing Material Consumption has been saved Successfully!" }));
                }
                catch (Exception exception)
                {
                    return(this.Json(new { success = false, data = exception.InnerException != null ? exception.InnerException.Message : exception.Message }));
                }
            }
        }
Esempio n. 3
0
 public ActionResult SaveCrateAndBoxConsumption(int PackingId, List <iffsPackingCrateAndBoxConsumption> PackingMaterialConsumption)
 {
     using (var transaction = new TransactionScope())
     {
         _context.Database.Connection.Open();
         try
         {
             foreach (var item in PackingMaterialConsumption)
             {
                 item.Date     = DateTime.Now;
                 item.HeaderId = PackingId;
                 if (item.Id.Equals(0))
                 {
                     _CrateAndBoxConsumption.AddNew(item);
                 }
                 else
                 {
                     _CrateAndBoxConsumption.Edit(item);
                 }
             }
             _context.SaveChanges();
             transaction.Complete();
             return(this.Json(new { success = true, data = " Packing Material Consumption has been saved successfully!" }));
         }
         catch (Exception exception)
         {
             return(this.Json(new { success = false, data = exception.InnerException.Message }));
         }
     }
 }
Esempio n. 4
0
        public ActionResult Save(iffsServiceRate serviceRate)
        {
            try
            {
                var objServiceRate = _serviceRate.Find(o => o.Id != serviceRate.Id && o.ServiceId == serviceRate.ServiceId &&
                                                        o.CurrencyId == serviceRate.CurrencyId &&
                                                        o.OperationTypeId == serviceRate.OperationTypeId &&
                                                        o.ServiceUnitTypeId == serviceRate.ServiceUnitTypeId &&
                                                        o.ComparingSign == serviceRate.ComparingSign &&
                                                        o.Description == serviceRate.Description
                                                        );
                if (objServiceRate != null)
                {
                    return this.Json(new { success = false, data = "service Rate has already been registered!" });
                }
                if (serviceRate.Id.Equals(0))
                {
                    _serviceRate.AddNew(serviceRate);
                }
                else
                {
                    _serviceRate.Edit(serviceRate);
                }
                return this.Json(new { success = true, data = "Data has been saved successfully!" });

            }
            catch (Exception ex)
            {
                return this.Json(new { success = false, data = ex.InnerException != null ? ex.InnerException.Message : ex.Message });
            }
        }
Esempio n. 5
0
 public ActionResult SaveDetail(int headerId, List <iffsPackingMaterialList> PackingMaterialSettingDetail)
 {
     using (var transaction = new TransactionScope())
     {
         _context.Database.Connection.Open();
         try
         {
             foreach (var item in PackingMaterialSettingDetail)
             {
                 item.MaterialType = headerId == 1 ? MaterialType.Standard : MaterialType.CrateAndBox;
                 if (item.Id.Equals(0))
                 {
                     _PackingMaterialSetting.AddNew(item);
                 }
                 else
                 {
                     _PackingMaterialSetting.Edit(item);
                 }
             }
             _context.SaveChanges();
             transaction.Complete();
             return(this.Json(new { success = true, data = " Packing Survey Details has been saved successfully!" }));
         }
         catch (Exception exception)
         {
             return(this.Json(new { success = false, data = exception.InnerException.Message }));
         }
     }
 }
Esempio n. 6
0
 public ActionResult Save(int headerId, List <iffsPackingTruckAndMachine> PackingTruckAndMachine)
 {
     using (var transaction = new TransactionScope())
     {
         _context.Database.Connection.Open();
         try
         {
             foreach (var item in PackingTruckAndMachine)
             {
                 item.HeaderId = headerId;
                 if (item.Id.Equals(0))
                 {
                     _PackingTruckAndMachine.AddNew(item);
                 }
                 else
                 {
                     _PackingTruckAndMachine.Edit(item);
                 }
             }
             _context.SaveChanges();
             transaction.Complete();
             return(this.Json(new { success = true, data = " Packing Truck And Machine  has been saved successfully!" }));
         }
         catch (Exception exception)
         {
             return(this.Json(new { success = false, data = exception.InnerException.Message }));
         }
     }
 }
Esempio n. 7
0
 public ActionResult SaveAbsentDays(int headerId, List<iffsPackingStaff> StaffDetail)
 {
     using (var transaction = new TransactionScope())
     {
         _context.Database.Connection.Open();
         try
         {
             foreach (var item in StaffDetail)
             {
                 //iffsPackingDetail detail = new iffsPackingDetail();
                 //detail.Id = item.Id;
                 item.StaffId = headerId;
                 //detail.PackersId = item.PackersId;
                 if (item.Id.Equals(0))
                 {
                     _PackingStaff.AddNew(item);
                 }
                 else
                 {
                     _PackingStaff.Edit(item);
                 }
             }
             _context.SaveChanges();
             transaction.Complete();
             return this.Json(new { success = true, data = " Packing Staff Absent Dates has been saved successfully!" });
         }
         catch (Exception exception)
         {
             return this.Json(new { success = false, data = exception.InnerException.Message });
         }
     }
 }
Esempio n. 8
0
        public void saveDetail(string servicesString, int tquotationId)
        {
            servicesString = servicesString.Remove(servicesString.Length - 1);
            var servicesCollection = servicesString.Split(new[] { ';' });

            _quotationDetail.Delete(o => o.QuotationId == tquotationId);
            for (var i = 0; i < servicesCollection.Count(); i++)
            {
                var service = servicesCollection[i].Split(new[] { ':' });

                var objquotationDetail = new iffsQuotationDetail();
                objquotationDetail.OperationTypeId    = int.Parse(service[1]);
                objquotationDetail.CurrencyId         = int.Parse(service[2]);
                objquotationDetail.Quantity           = decimal.Parse(service[3]);
                objquotationDetail.QuotationId        = tquotationId;
                objquotationDetail.Remark             = service[5];
                objquotationDetail.ServiceUnitTypeId  = int.Parse(service[6]);
                objquotationDetail.UnitPrice          = decimal.Parse(service[7]);
                objquotationDetail.ServiceId          = int.Parse(service[8]);
                objquotationDetail.ServiceDescription = service[9];
                objquotationDetail.ComparingSign      = service[10];
                if (service[11] != null && service[11] != "undefined" && service[11] != "" && int.Parse(service[11]) != 0)
                {
                    objquotationDetail.ServiceRequestDetailId = int.Parse(service[11]);
                }



                _quotationDetail.AddNew(objquotationDetail);
            }
        }
Esempio n. 9
0
        public DirectResult Save(iffsShipmentType shipmentType)
        {
            using (var transaction = new TransactionScope((TransactionScopeOption.Required), new TransactionOptions {
                IsolationLevel = IsolationLevel.ReadCommitted
            }))
            {
                _context.Database.Connection.Open();
                _context.Database.CommandTimeout = int.MaxValue;
                try
                {
                    if (shipmentType.Id.Equals(0))
                    {
                        _ShipmentType.AddNew(shipmentType);
                    }
                    else
                    {
                        _ShipmentType.Edit(shipmentType);
                    }


                    _context.SaveChanges();
                    transaction.Complete();
                    return(this.Json(new { success = true, data = "Shipment Type has been saved Successfully!" }));
                }
                catch (Exception exception)
                {
                    return(this.Json(new { success = false, data = exception.InnerException != null ? exception.InnerException.Message : exception.Message }));
                }
            }
        }
Esempio n. 10
0
 public ActionResult SaveMaterial(int headerId, IList <iffsPackingMaterial> packingMaterail)
 {
     using (var transaction = new TransactionScope())
     {
         _context.Database.Connection.Open();
         try
         {
             foreach (var item in packingMaterail)
             {
                 item.SurveyId = headerId;
                 if (item.Id.Equals(0))
                 {
                     _PackingMaterialSurvey.AddNew(item);
                 }
                 else
                 {
                     _PackingMaterialSurvey.Edit(item);
                 }
             }
             _context.SaveChanges();
             transaction.Complete();
             return(this.Json(new { success = true, data = " Packing Survey Details has been saved successfully!" }));
         }
         catch (Exception exception)
         {
             return(this.Json(new { success = false, data = exception.InnerException.Message }));
         }
     }
 }
Esempio n. 11
0
        public ActionResult Save(iffsInvoiceHeader invoiceHeader)
        {
            using (var transaction = new TransactionScope((TransactionScopeOption.Required), new TransactionOptions {
                IsolationLevel = IsolationLevel.ReadCommitted
            }))
            {
                _context.Database.Connection.Open();
                _context.Database.CommandTimeout = int.MaxValue;

                var    hashtable = JsonConvert.DeserializeObject <Hashtable>(Request.Params["record"]);
                string action    = hashtable["action"].ToString();
                try
                {
                    if (Request.Params["WithHoldingApplied"] != null && Request.Params["WithHoldingApplied"].ToString().Equals("on"))
                    {
                        invoiceHeader.WithHoldingApplied = true;
                    }
                    else
                    {
                        invoiceHeader.WithHoldingApplied = false;
                    }

                    if (invoiceHeader.Id == 0)
                    {
                        invoiceHeader.PreparedDate = DateTime.Now;
                        CyberErp.Presentation.Iffs.Web.MvcApplication httpapplication = HttpContext.ApplicationInstance as CyberErp.Presentation.Iffs.Web.MvcApplication;
                        httpapplication.Application.Lock();
                        if (action == "Add" && invoiceHeader.InvoiceNo == "Auto-Genereted")
                        {
                            invoiceHeader.InvoiceNo = GetDocumentNumber("Invoice");
                        }
                        _invoiceHeader.AddNew(invoiceHeader);
                        if (action == "Add" && invoiceHeader.InvoiceNo == "Auto-Genereted")
                        {
                            UpdateDocumentNumber("Invoice");
                        }
                        httpapplication.Application.UnLock();
                    }
                    else
                    {
                        _invoiceHeader.Edit(invoiceHeader);
                    }
                    var servicesString = hashtable["services"].ToString();
                    var operationIds   = hashtable["operationIds"].ToString();

                    SaveInvoiceOperations(operationIds, invoiceHeader.Id);
                    saveDetail(servicesString, invoiceHeader.Id);
                    _context.SaveChanges();
                    transaction.Complete();
                    return(this.Json(new { success = true, data = "Data has been saved successfully!", invoiceId = invoiceHeader.Id }));
                }
                catch (Exception exception)
                {
                    return(this.Json(new { success = false, data = exception.InnerException != null ? exception.InnerException.Message : exception.Message }));
                }
            }
        }
Esempio n. 12
0
        public DirectResult Save(iffsSurveyRequest SurveyRequest)
        {
            using (var transaction = new TransactionScope((TransactionScopeOption.Required), new TransactionOptions {
                IsolationLevel = IsolationLevel.ReadCommitted
            }))
            {
                _context.Database.Connection.Open();
                _context.Database.CommandTimeout = int.MaxValue;
                try
                {
                    int employeeId = 0;
                    var objUser    = (coreUser)Session[Constants.CurrentUser];
                    if (objUser != null && objUser.EmployeeId != null)
                    {
                        employeeId = (int)objUser.EmployeeId;
                    }
                    if (SurveyRequest.Id.Equals(0))
                    {
                        SurveyRequest.PreparedById = employeeId;
                        SurveyRequest.Date         = DateTime.Now;

                        /* ***************************************************
                        * Concurrency controlling scheme using global locking
                        * ***************************************************/

                        var objOperationType = _lookup.GetAll((Lookups.LupOperationType)).Where(o => o.Id == SurveyRequest.Id).FirstOrDefault();
                        CyberErp.Presentation.Iffs.Web.MvcApplication httpapplication = HttpContext.ApplicationInstance as CyberErp.Presentation.Iffs.Web.MvcApplication;
                        httpapplication.Application.Lock();
                        SurveyRequest.Number = _documentNoSetting.GetDocumentNumber("SurveyRequest");//objOperationType.Code + "/" +
                        _SurveyRequest.Add(SurveyRequest);
                        _documentNoSetting.SaveChanges();
                        httpapplication.Application.UnLock();

                        _notification.AddNew(new iffsNotification
                        {
                            Operation = Constants.SURVEYREQUEST,
                            ObjectId  = SurveyRequest.Id,
                            ActorId   = SurveyRequest.PreparedById,
                            Date      = DateTime.Now,
                            Message   = "Ordering Client Address: " + SurveyRequest.OrderingClientId + " Receiving Client Address: " + SurveyRequest.ReceivingClientId,
                            IsViewed  = false
                        });
                    }
                    else
                    {
                        _SurveyRequest.Edit(SurveyRequest);
                    }
                    _context.SaveChanges();
                    transaction.Complete();
                    return(this.Json(new { success = true, data = "Survey Request has been saved Successfully!" }));
                }
                catch (Exception exception)
                {
                    return(this.Json(new { success = false, data = exception.InnerException != null ? exception.InnerException.Message : exception.Message }));
                }
            }
        }
Esempio n. 13
0
        public DirectResult Check(docConfirmation docConfirmation)
        {
            try
            {
                int currentEmployeeId = 0;
                var objUser           = (coreUser)Session[Constants.CurrentUser];
                if (objUser != null && objUser.EmployeeId != null)
                {
                    currentEmployeeId = (int)objUser.EmployeeId;
                }

                var objJobOrder = _jobOrderHeader.Get(j => j.Id == docConfirmation.Id);

                if (docConfirmation.Type == Constants.DOCUMENT_CONFIRM)
                {
                    objJobOrder.CheckedById = currentEmployeeId;
                    objJobOrder.CheckedDate = DateTime.Now;
                    _context.SaveChanges();

                    return(this.Json(new { success = true, data = "Record successfully checked!" }));
                }
                else
                {
                    //Send to notification table
                    _notification.AddNew(new iffsNotification
                    {
                        Operation = Constants.NTF_OPN_JOB_ORDER,
                        ObjectId  = objJobOrder.Id,
                        ActorId   = objJobOrder.PreparedById,
                        Date      = DateTime.Now,
                        Message   = docConfirmation.Comment,
                        IsViewed  = false
                    });
                    return(this.Json(new { success = true, data = "Reject notification sent for a person who prepares the selected document!" }));
                }
            }
            catch (Exception exception)
            {
                return(this.Json(new { success = false, data = exception.Message }));
            }
        }
Esempio n. 14
0
 public ActionResult Save(iffsReceivingClient ReceivingClient)
 {
     if (ReceivingClient.Id.Equals(0))
     {
         _ReceivingClient.AddNew(ReceivingClient);
     }
     else
     {
         _ReceivingClient.Edit(ReceivingClient);
     }
     return(this.Json(new { success = true, ReceivingClientId = ReceivingClient.Id, data = "Data has been saved successfully!" }));
 }
Esempio n. 15
0
 public ActionResult Save(iffsTermsAndConditionsTemplate termsAndConditionsTemplate)
 {
     if (termsAndConditionsTemplate.Id.Equals(0))
     {
         _termsAndConditionsTemplate.AddNew(termsAndConditionsTemplate);
     }
     else
     {
         _termsAndConditionsTemplate.Edit(termsAndConditionsTemplate);
     }
     return(this.Json(new { success = true, data = "Data has been saved successfully!" }));
 }
Esempio n. 16
0
 public ActionResult Save(iffsContainer container)
 {
     if (container.Id.Equals(0))
     {
         _container.AddNew(container);
     }
     else
     {
         _container.Edit(container);
     }
     return(this.Json(new { success = true, customerId = container.Id, data = "Data has been saved successfully!" }));
 }
 public ActionResult Save(iffsDocumentNoSetting documentNoSetting)
 {
     if (documentNoSetting.Id.Equals(0))
     {
         _documentNoSetting.AddNew(documentNoSetting);
     }
     else
     {
         _documentNoSetting.Edit(documentNoSetting);
     }
     return(this.Json(new { success = true, data = "Data has been saved successfully!" }));
 }
Esempio n. 18
0
        public ActionResult Save(iffsJobOrderTemplate jobOrderTemplate)
        {
            if (jobOrderTemplate.Id.Equals(0))
            {
                _jobOrderTemplate.AddNew(jobOrderTemplate);
            }
            else
            {
                _jobOrderTemplate.Edit(jobOrderTemplate);
            }

            return(this.Json(new { success = true, data = "Data has been saved successfully!" }));
        }
Esempio n. 19
0
        public ActionResult SaveStatusTemplate(iffsContainerStatusTemplate containerStatusTemplate)
        {
            if (containerStatusTemplate.Id.Equals(0))
            {
                _containerStatusTemplate.AddNew(containerStatusTemplate);
            }
            else
            {
                _containerStatusTemplate.Edit(containerStatusTemplate);
            }

            return(this.Json(new { success = true, data = "Data has been saved successfully!" }));
        }
        public ActionResult Save(iffsOperationStatusTemplate operationStatusTemplate)
        {
            if (operationStatusTemplate.Id.Equals(0))
            {
                _operationStatusTemplate.AddNew(operationStatusTemplate);
            }
            else
            {
                _operationStatusTemplate.Edit(operationStatusTemplate);
            }

            return(this.Json(new { success = true, data = "Data has been saved successfully!" }));
        }
Esempio n. 21
0
 public ActionResult Save(iffsCustomer customer)
 {
     if (customer.Id.Equals(0))
     {
         customer.Code = GetDocumentNumber("Customer");
         _customer.AddNew(customer);
         UpdateDocumentNumber("Service Request");
     }
     else
     {
         _customer.Edit(customer);
     }
     return(this.Json(new { success = true, customerId = customer.Id, data = "Data has been saved successfully!" }));
 }
Esempio n. 22
0
        public ActionResult Upload(iffsServiceRequestDocuments serviceRequestDocs)
        {
            try
            {
                string msg    = "";
                string docUrl = "";
                string fileExtension;
                string filePath;


                var hashtable = JsonConvert.DeserializeObject <Hashtable>(Request.Params["record"]);

                if (hashtable["docUrl"].ToString() != "")
                {
                    docUrl = hashtable["docUrl"].ToString().Replace(",", "");
                }

                string             appPath      = HttpContext.Request.ApplicationPath;
                string             physicalPath = HttpContext.Request.MapPath(appPath);
                string             location     = physicalPath + "\\Upload\\ServiceRequestDocs\\";
                HttpPostedFileBase postedFile   = Request.Files["DocumentUrl"];

                var    requestF = serviceRequestDocs.RequestId + "\\";
                string serviceRequestDocPath = System.IO.Path.Combine(location, requestF);
                System.IO.Directory.CreateDirectory(serviceRequestDocPath);

                serviceRequestDocs.DocumentUrl = Path.GetFileName(postedFile.FileName);;
                if ((postedFile != null) && (postedFile.ContentLength > 0))
                {
                    fileExtension = System.IO.Path.GetExtension(postedFile.FileName);
                    filePath      = serviceRequestDocPath + Path.GetFileName(postedFile.FileName);
                    postedFile.SaveAs(filePath);
                }

                if (serviceRequestDocs.Id.Equals(0))
                {
                    serviceRequestDocs.DocumentUrl = Path.GetFileName(docUrl);

                    _serviceRequestDocs.AddNew(serviceRequestDocs);
                }

                return(this.Json(new { success = true, data = "File has has been uploaded successfully!" }));
            }
            catch (System.Exception ex)
            {
                return(this.Json(new { success = false, data = "Unable to upload file!" }));
            }
        }
Esempio n. 23
0
        public ActionResult Save(iffsQuotationHeaderExt quotationExt)
        {
            using (var transaction = new TransactionScope((TransactionScopeOption.Required), new TransactionOptions {
                IsolationLevel = IsolationLevel.ReadCommitted
            }))
            {
                _context.Database.Connection.Open();
                _context.Database.CommandTimeout = int.MaxValue;

                var    hashtable = JsonConvert.DeserializeObject <Hashtable>(quotationExt.record);
                string action    = hashtable["action"].ToString();
                iffsQuotationHeader quotation = new iffsQuotationHeader();
                Utility.CopyObject(quotationExt, quotation);
                var quotationNo = quotation.QuotationNo;
                try
                {
                    if (quotation.Id == 0)
                    {
                        quotation.PreparedDate = DateTime.Now;
                        CyberErp.Presentation.Iffs.Web.MvcApplication httpapplication = HttpContext.ApplicationInstance as CyberErp.Presentation.Iffs.Web.MvcApplication;
                        httpapplication.Application.Lock();
                        if (action == "Add" && quotationNo == "Auto-Genereted")
                        {
                            quotation.QuotationNo = GetDocumentNumber("Quotation");
                        }
                        _quotationHeader.AddNew(quotation);
                        if (action == "Add" && quotationNo == "Auto-Genereted")
                        {
                            UpdateDocumentNumber("Quotation");
                        }
                        httpapplication.Application.UnLock();
                    }
                    else
                    {
                        _quotationHeader.Edit(quotation);
                    }
                    var servicesString = hashtable["services"].ToString();
                    saveDetail(servicesString, quotation.Id);
                    _context.SaveChanges();
                    transaction.Complete();
                    return(this.Json(new { success = true, data = "Data has been saved successfully!", quotationId = quotation.Id }));
                }
                catch (Exception exception)
                {
                    return(this.Json(new { success = false, data = exception.InnerException != null ? exception.InnerException.Message : exception.Message }));
                }
            }
        }
Esempio n. 24
0
        public ActionResult Save(iffsService service)
        {
            if (Request.Params["IsTaxable"] != null)
            {
                service.IsTaxable = true;
            }

            if (service.Id.Equals(0))
            {
                _service.AddNew(service);
            }
            else
            {
                _service.Edit(service);
            }
            return(this.Json(new { success = true, data = "Data has been saved successfully!" }));
        }
Esempio n. 25
0
        public ActionResult Save(string operationTypes, int operationTypeId)
        {
            operationTypes = operationTypes.Remove(operationTypes.Length - 1);
            var servicesCollection = operationTypes.Split(new[] { ';' });

            _OperationDocumentTemplate.Delete(o => o.OperationTypeId == operationTypeId);
            for (var i = 0; i < servicesCollection.Count(); i++)
            {
                var service = servicesCollection[i].Split(new[] { ':' });
                var objOperationDocumentTemplate = new iffsOperationDocumentTemplate();
                objOperationDocumentTemplate.DocumentTypeId  = int.Parse(service[0]);
                objOperationDocumentTemplate.OperationTypeId = operationTypeId;

                _OperationDocumentTemplate.AddNew(objOperationDocumentTemplate);
            }
            return(this.Json(new { success = true, data = "Data has been saved successfully!" }));
        }
Esempio n. 26
0
        public void SaveInvoiceOperations(string operationIds, int invoiceId)
        {
            var operationId           = 0;
            var operationIdCollection = operationIds.Split(new[] { ',' });

            _invoiceOperation.Delete(q => q.InvoiceHeaderId == invoiceId);
            IList <iffsInvoiceOperation> invoiceQuotationList = new List <iffsInvoiceOperation>();

            for (var i = 0; i < operationIdCollection.Count(); i++)
            {
                int.TryParse(operationIdCollection[i], out operationId);
                var objInvoiceQuotation = new iffsInvoiceOperation {
                    InvoiceHeaderId = invoiceId, OperationId = operationId
                };
                _invoiceOperation.AddNew(objInvoiceQuotation);
            }
        }
Esempio n. 27
0
        public ActionResult Save(iffsOperation operation)
        {
            using (var transaction = new TransactionScope((TransactionScopeOption.Required), new TransactionOptions {
                IsolationLevel = IsolationLevel.ReadCommitted
            }))
            {
                _context.Database.Connection.Open();
                _context.Database.CommandTimeout = int.MaxValue;
                try
                {
                    int employeeId = 0;
                    var objUser    = (coreUser)Session[Constants.CurrentUser];
                    if (objUser != null && objUser.EmployeeId != null)
                    {
                        employeeId = (int)objUser.EmployeeId;
                    }


                    if (operation.Id.Equals(0))
                    {
                        operation.PreparedById = employeeId;
                        operation.PreparedDate = DateTime.Now;

                        CyberErp.Presentation.Iffs.Web.MvcApplication httpapplication = HttpContext.ApplicationInstance as CyberErp.Presentation.Iffs.Web.MvcApplication;
                        httpapplication.Application.Lock();
                        //operation.OperationNo = GetDocumentNumber("Operation");
                        _operation.AddNew(operation);
                        //UpdateDocumentNumber("Operation");
                        httpapplication.Application.UnLock();
                    }
                    else
                    {
                        _operation.Edit(operation);
                    }

                    _context.SaveChanges();
                    transaction.Complete();
                    return(this.Json(new { success = true, data = "Data has been saved successfully!" }));
                }
                catch (Exception exception)
                {
                    return(this.Json(new { success = false, data = exception.InnerException != null ? exception.InnerException.Message : exception.Message }));
                }
            }
        }
Esempio n. 28
0
        public ActionResult SaveTermAndCondition(string termandCondition, int quotationId)
        {
            var objTermandCondition = _quotationTermandCondition.GetAll().AsQueryable().Where(o => o.QuotationId == quotationId).FirstOrDefault();

            if (objTermandCondition != null)
            {
                objTermandCondition.TermsAndConditions = termandCondition;
            }
            else
            {
                var record = new iffsQuotationTermandCondition();
                record.QuotationId        = quotationId;
                record.TermsAndConditions = termandCondition;
                _quotationTermandCondition.AddNew(record);
            }
            _context.SaveChanges();
            return(this.Json(new { success = true, data = "Data has been saved successfully!" }));
        }
Esempio n. 29
0
        public DirectResult SaveStatus(string param)
        {
            try
            {
                var statuses = JsonConvert.DeserializeObject <List <object> >(param);
                int id;

                for (var i = 0; i < statuses.Count(); i++)
                {
                    var hashtable = JsonConvert.DeserializeObject <Hashtable>(statuses[i].ToString());

                    int.TryParse(hashtable["Id"].ToString(), out id);

                    if (id == 0)
                    {
                        _containerStatus.AddNew(new iffsContainerStatus
                        {
                            ContainerId = int.Parse(hashtable["ContainerId"].ToString()),
                            StatusId    = int.Parse(hashtable["StatusId"].ToString()),
                            Value       = hashtable["Value"].ToString(),
                            Remark      = hashtable["Remark"].ToString()
                        });
                    }
                    else
                    {
                        _containerStatus.Edit(new iffsContainerStatus
                        {
                            Id          = id,
                            ContainerId = int.Parse(hashtable["ContainerId"].ToString()),
                            StatusId    = int.Parse(hashtable["StatusId"].ToString()),
                            Value       = hashtable["Value"].ToString(),
                            Remark      = hashtable["Remark"].ToString()
                        });
                    }
                }
                return(this.Json(new { success = true, data = "Container Status have been saved successfully!" }));
            }
            catch (Exception ex)
            {
                return(this.Json(new { success = false, data = ex.InnerException != null ? ex.InnerException.Message : ex.Message }));
            }
        }
Esempio n. 30
0
        public ActionResult Save(iffsRoleSetting roleSetting)
        {
            var objroleSetting = _roleSetting.Find(c => (c.RoleId == roleSetting.RoleId && c.Id != roleSetting.Id));

            if (objroleSetting != null)
            {
                var result = new { success = false, data = "The selected Role is already on the list!" };
                return(this.Json(result));
            }

            if (roleSetting.Id.Equals(0))
            {
                _roleSetting.AddNew(roleSetting);
            }
            else
            {
                _roleSetting.Edit(roleSetting);
            }
            return(this.Json(new { success = true, data = "Data has been saved successfully!" }));
        }