public OperationsStatus InsertOrder(Order orderObj) { OperationsStatus operationsStatusObj = null; try { operationsStatusObj = InsertOrderHeader(orderObj); if (operationsStatusObj.StatusCode == 1) { if (orderObj.OrderDetailsList != null) { foreach (var i in orderObj.OrderDetailsList) { i.OrderID = int.Parse(operationsStatusObj.ReturnValues.ToString()); i.commonObj = orderObj.commonObj; operationsStatusObj = InsertOrderDetail(i); } } } } catch (Exception ex) { throw ex; } return(operationsStatusObj); }
public OperationsStatus NotificationMobilePush(Notification notification) { OperationsStatus operationsStatus = null; try { //Call SendToFCM(string titleString, string descriptionString, Boolean isCommon, string CustomerID = ""); //on success call NotificationPush operationsStatus = _notificationRepository.NotificationPush(notification); if (operationsStatus.StatusCode == 1) { //call customer detail //call notificatoin cloud system if (notification.customer.ID == 0) { SendToFCM(notification.Title, notification.Message, true); } else { SendToFCM(notification.Title, notification.Message, false, notification.customer.ID.ToString()); } } } catch (Exception ex) { throw ex; } return(operationsStatus); }
public OperationsStatus UpdateCustomerImage(Customer customer) { OperationsStatus operationsStatusObj = new OperationsStatus(); try { SqlParameter statusCode = null; SqlParameter oldImageUrl = null; using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[UpdateCustomerProfileImage]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ID", SqlDbType.NVarChar, 250).Value = customer.ID; cmd.Parameters.Add("@ProfileImageID", SqlDbType.UniqueIdentifier).Value = customer.ProfileImageID; cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar, 250).Value = customer.logDetailsObj.UpdatedBy; cmd.Parameters.Add("@UpdatedDate", SqlDbType.SmallDateTime).Value = customer.logDetailsObj.UpdatedDate; statusCode = cmd.Parameters.Add("@Status", SqlDbType.SmallInt); oldImageUrl = cmd.Parameters.Add("@OldImgUrl", SqlDbType.NVarChar, -1); statusCode.Direction = ParameterDirection.Output; oldImageUrl.Direction = ParameterDirection.Output;//For deletion of old image file cmd.ExecuteNonQuery(); switch (statusCode.Value.ToString()) { case "0": // not Successfull operationsStatusObj.StatusCode = Int16.Parse(statusCode.Value.ToString()); operationsStatusObj.StatusMessage = constObj.UpdateFailure; break; case "1": //Insert Successfull operationsStatusObj.StatusCode = Int16.Parse(statusCode.Value.ToString()); operationsStatusObj.ReturnValues = oldImageUrl.Value.ToString(); operationsStatusObj.StatusMessage = constObj.UpdateSuccess; break; default: break; } } } } catch (Exception ex) { operationsStatusObj.StatusMessage = ex.Message; throw ex; } return(operationsStatusObj); }
public Customer GetCustomer(int CustomerID, OperationsStatus Status) { Customer mycustomer = null; try { using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.Parameters.Add("@ID", SqlDbType.Int).Value = CustomerID; cmd.CommandText = "[GetCustomer]"; cmd.CommandType = CommandType.StoredProcedure; using (SqlDataReader sdr = cmd.ExecuteReader()) { if ((sdr != null) && (sdr.HasRows)) { if (sdr.Read()) { mycustomer = new Customer(); mycustomer.ID = (sdr["ID"].ToString() != "" ? int.Parse(sdr["ID"].ToString()) : mycustomer.ID); mycustomer.Name = (sdr["Name"].ToString() != "" ? sdr["Name"].ToString() : mycustomer.Name); mycustomer.Email = (sdr["Email"].ToString() != "" ? sdr["Email"].ToString() : mycustomer.Email); mycustomer.Mobile = (sdr["Mobile"].ToString() != "" ? sdr["Mobile"].ToString() : mycustomer.Mobile); mycustomer.Language = (sdr["Language"].ToString() != "" ? sdr["Language"].ToString() : mycustomer.Language); mycustomer.Gender = (sdr["Gender"].ToString() != "" ? sdr["Gender"].ToString() : mycustomer.Gender); mycustomer.ProfileImageID = (sdr["ProfileImageID"].ToString() != "" ? Guid.Parse(sdr["ProfileImageID"].ToString()) : mycustomer.ProfileImageID); mycustomer.OrdersCount = (sdr["OrdersCount"].ToString() != "" ? int.Parse(sdr["OrdersCount"].ToString()) : mycustomer.OrdersCount); mycustomer.BookingsCount = (sdr["BookingsCount"].ToString() != "" ? int.Parse(sdr["BookingsCount"].ToString()) : mycustomer.BookingsCount); mycustomer.QuotationsCount = (sdr["QuotationsCount"].ToString() != "" ? int.Parse(sdr["QuotationsCount"].ToString()) : mycustomer.QuotationsCount); mycustomer.OrdersCountHistory = (sdr["OrdersCountHistory"].ToString() != "" ? int.Parse(sdr["OrdersCountHistory"].ToString()) : mycustomer.OrdersCountHistory); mycustomer.BookingsCountHistory = (sdr["BookingsCountHistory"].ToString() != "" ? int.Parse(sdr["BookingsCountHistory"].ToString()) : mycustomer.BookingsCountHistory); mycustomer.QuotationsCountHistory = (sdr["QuotationsCountHistory"].ToString() != "" ? int.Parse(sdr["QuotationsCountHistory"].ToString()) : mycustomer.QuotationsCountHistory); mycustomer.IsActive = bool.Parse(sdr["ActiveYN"].ToString()); mycustomer.customerAddress = new CustomerAddress(); mycustomer.customerAddress.Address = (sdr["Address"].ToString() != "" ? sdr["Address"].ToString() : mycustomer.customerAddress.Address); mycustomer.customerAddress.City = (sdr["City"].ToString() != "" ? sdr["City"].ToString() : mycustomer.customerAddress.City); mycustomer.customerAddress.StateProvince = (sdr["StateProvince"].ToString() != "" ? sdr["StateProvince"].ToString() : mycustomer.customerAddress.StateProvince); mycustomer.customerAddress.country = new Country(); mycustomer.customerAddress.country.Name = (sdr["CountryName"].ToString() != "" ? sdr["CountryName"].ToString() : mycustomer.customerAddress.country.Name); mycustomer.logDetailsObj = new LogDetails(); mycustomer.logDetailsObj.CreatedDate = (sdr["CreatedDate"].ToString() != "" ? DateTime.Parse(sdr["CreatedDate"].ToString()) : mycustomer.logDetailsObj.CreatedDate); } }//if } } } } catch (Exception ex) { throw ex; } return(mycustomer); }
public OperationsStatus InsertCustomerImage(Customer customerObj) { OperationsStatus operationsStatusObj = null; try { if (customerObj.ImageUrl != "" && customerObj.ImageUrl != null) { OtherImages otherImgObj = new OtherImages(); otherImgObj.URL = customerObj.ImageUrl; otherImgObj.ID = customerObj.ProfileImageID.Value; otherImgObj.ImageType = ImageTypesPreffered.ProfileImage; otherImgObj.LogDetails = customerObj.logDetailsObj; operationsStatusObj = _masterRepository.InsertImage(otherImgObj); if (operationsStatusObj.StatusCode == 1) //Image id insertion success { operationsStatusObj = _customerRepository.UpdateCustomerImage(customerObj); //Updates customer image id and deletes old image from other images if (operationsStatusObj.ReturnValues != null && operationsStatusObj.ReturnValues.ToString() != "") { //Deletes old image file File.Delete(HttpContext.Current.Server.MapPath(operationsStatusObj.ReturnValues.ToString())); } } } } catch (Exception ex) { throw ex; } return(operationsStatusObj); }
public OperationsStatus InsertUpdateUser(User user) { OperationsStatus operationsStatus = null; try { //Encryption if ((!string.IsNullOrEmpty(user.LoginName)) && (!string.IsNullOrEmpty(user.Password))) { user.Password = Encrypt(user.Password); //case sensitive login logic-making it lower case user.LoginName = user.LoginName.ToLower(); switch (user.ID) { case 0: operationsStatus = _authenticationRepository.InsertUser(user); break; default: operationsStatus = _authenticationRepository.UpdateUser(user); break; } } } catch (Exception ex) { throw ex; } return(operationsStatus); }
public OperationsStatus TreeViewUpdateAttributeSetLink(List <AttributeSetLink> TreeViewData, int ID) { OperationsStatus operationsStatusObj = new OperationsStatus(); try { //Delete the link data usng AttributeSet ID operationsStatusObj = _attributeToSetLinksRepository.DeleteAttributeSetLink(ID); // foreach (AttributeSetLink i in TreeViewData) { if (i.AttributeSetID != 0) { i.AttributeSetID = ID; operationsStatusObj = _attributeToSetLinksRepository.InsertAttributeSetLink(i); } } } catch (Exception ex) { operationsStatusObj.StatusMessage = ex.Message; operationsStatusObj.StatusCode = 0; } return(operationsStatusObj); }
public OperationsStatus UpdateProduct(Product productObj) { OperationsStatus operationsStatus = null; try { switch (productObj.ProductType) { case 'S': productObj.ProductDetails = productObj.ProductDetails == null ? null : productObj.ProductDetails. Select(prodDet => { prodDet.DefaultOption = true; return(prodDet); }).ToList(); operationsStatus = _productRepository.UpdateProduct(productObj); break; case 'C': productObj.ProductDetails.Clear(); operationsStatus = _productRepository.UpdateProduct(productObj); break; } } catch (Exception ex) { throw ex; } return(operationsStatus); }
/// <summary> /// new product insertion /// for product type simple there will be product details /// for product type configurable ther will be no product details /// </summary> /// <param name="productObj"></param> /// <returns>OperationsStatus</returns> public OperationsStatus InsertProduct(Product productObj) { OperationsStatus operationsStatus = null; try { switch (productObj.ProductType) { case 'S': productObj.ProductDetails = productObj.ProductDetails == null ? null : productObj.ProductDetails. Select(prodDet => { prodDet.DefaultOption = true; return(prodDet); }).ToList(); operationsStatus = _productRepository.InsertProduct(productObj); break; case 'C': //product detail not need to insert for configurable product productObj.ProductDetails.Clear(); operationsStatus = _productRepository.InsertProduct(productObj); break; } } catch (Exception ex) { throw ex; } return(operationsStatus); }
//public async Task<bool> albertMail(Notification notification) //{ // try // { // string EmailFromAddress = System.Web.Configuration.WebConfigurationManager.AppSettings["EmailFromAddress"]; // string smtpUserName = System.Web.Configuration.WebConfigurationManager.AppSettings["SMTP-UserName"]; // string smtpPassword = System.Web.Configuration.WebConfigurationManager.AppSettings["SMTP-Password"]; // string myport = System.Web.Configuration.WebConfigurationManager.AppSettings["Port"]; // var from = new MailAddress(EmailFromAddress, "Admin_@_PartyEC"); // var to = new MailAddress("*****@*****.**"); // var useDefaultCredentials = true; // var enableSsl = false; // // var replyto = "*****@*****.**"; // set here your email; // var userName = smtpUserName; // var password = smtpPassword; // var port = int.Parse(myport); // var host = System.Web.Configuration.WebConfigurationManager.AppSettings["SMTP-host"]; // userName = System.Web.Configuration.WebConfigurationManager.AppSettings["SMTP-UserName"]; // setup here the username; // password = System.Web.Configuration.WebConfigurationManager.AppSettings["SMTP-Password"]; // setup here the password; // bool.TryParse("true", out useDefaultCredentials); //setup here if it uses defaault credentials // bool.TryParse("true", out enableSsl); //setup here if it uses ssl // // int.TryParse(myport, out port); //setup here the port // host = System.Web.Configuration.WebConfigurationManager.AppSettings["SMTP-host"]; //setup here the host // using (var mail = new MailMessage(from, to)) // { // mail.Subject = "testing mail by albert"; // mail.Body = "<table><tr>Thrithavam from table</tr></table>"; // mail.IsBodyHtml = true; // // mail.ReplyToList.Add(new MailAddress(replyto, "*****@*****.**")); // mail.ReplyToList.Add(from); // mail.DeliveryNotificationOptions = DeliveryNotificationOptions.Delay | // DeliveryNotificationOptions.OnFailure | // DeliveryNotificationOptions.OnSuccess; // using (var client = new SmtpClient()) // { // client.Host = host; // client.Port = int.Parse(myport); // client.EnableSsl = enableSsl; // client.UseDefaultCredentials = useDefaultCredentials; // client.DeliveryMethod = SmtpDeliveryMethod.Network; // // client.Credentials= // if (!client.UseDefaultCredentials && !string.IsNullOrEmpty(userName) && // !string.IsNullOrEmpty(password)) // { // client.Credentials = new NetworkCredential(userName, password); // } // client.Credentials = new NetworkCredential(userName, password); // await client.SendMailAsync(mail); // } // } // } // catch(Exception ex) // { // } // return true; //} //public async Task<bool> albertMail(Notification notification) //{ // try // { // string EmailFromAddress = System.Web.Configuration.WebConfigurationManager.AppSettings["EmailFromAddress"]; // string host = System.Web.Configuration.WebConfigurationManager.AppSettings["SMTP-host"]; // string smtpUserName = System.Web.Configuration.WebConfigurationManager.AppSettings["SMTP-UserName"]; // string smtpPassword = System.Web.Configuration.WebConfigurationManager.AppSettings["SMTP-Password"]; // string port = System.Web.Configuration.WebConfigurationManager.AppSettings["Port"]; // var from = new MailAddress(EmailFromAddress, "Admin_@_PartyEC"); // var to = new MailAddress("*****@*****.**"); // // var useDefaultCredentials = true; // var enableSsl = false; // // var replyto = "*****@*****.**"; // set here your email; // // bool.TryParse("true", out useDefaultCredentials); //setup here if it uses defaault credentials // bool.TryParse("true", out enableSsl); //setup here if it uses ssl // // int.TryParse(myport, out port); //setup here the port // // host = System.Web.Configuration.WebConfigurationManager.AppSettings["SMTP-host"]; //setup here the host // using (var mail = new MailMessage(from, to)) // { // mail.Subject = "ATTN"; // mail.Body = "wonderfull after ge"; // mail.IsBodyHtml = true; // // mail.ReplyToList.Add(new MailAddress(replyto, "*****@*****.**")); // // mail.ReplyToList.Add(from); // mail.DeliveryNotificationOptions = DeliveryNotificationOptions.Delay | // DeliveryNotificationOptions.OnFailure | // DeliveryNotificationOptions.OnSuccess; // using (var client = new SmtpClient()) // { // client.Host = host; // client.Port = int.Parse(port); // client.EnableSsl = enableSsl; // //client.UseDefaultCredentials = useDefaultCredentials; // client.DeliveryMethod = SmtpDeliveryMethod.Network; // // client.Credentials= // //if (!client.UseDefaultCredentials && !string.IsNullOrEmpty(smtpUserName) && // // !string.IsNullOrEmpty(password)) // //{ // // client.Credentials = new NetworkCredential(smtpUserName, smtpPassword); // //} // client.Credentials = new NetworkCredential(smtpUserName, smtpPassword); // await client.SendMailAsync(mail); // } // } // } // catch (Exception ex) // { // return false; // } // return true; // } public async Task <bool> NotificationEmailPush(Notification notification) { bool sendsuccess = false; try { //Get customer information OperationsStatus opstatus = new OperationsStatus(); Customer customer = null; customer = _customerBusiness.GetCustomer(notification.customer.ID, opstatus); Mail _mail = new Mail(); using (StreamReader reader = new StreamReader(HttpContext.Current.Server.MapPath("~/PartyEcTemplates/Notifications.html"))) { _mail.Body = reader.ReadToEnd(); } _mail.Body = _mail.Body.Replace("{CustomerName}", customer.Name); _mail.Body = _mail.Body.Replace("{Message}", notification.Message); _mail.Subject = notification.Title; _mail.To = customer.Email; sendsuccess = await _mailBusiness.MailSendAsync(_mail); } catch (Exception ex) { throw ex; } return(sendsuccess); }
public void OnWorkPauseRequested() { if (_operationsManager.PauseWork()) { _operationsStatus = OperationsStatus.Paused; _view.SetResumeButton(); } }
public OperationsStatus NotificationPush(Notification notification) { OperationsStatus operationsStatusObj = null; try { SqlParameter statusCode = null; using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[InsertNotification]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@CustomerID", SqlDbType.Int).Value = notification.customer.ID; cmd.Parameters.Add("@Type", SqlDbType.NVarChar, 10).Value = notification.Type; cmd.Parameters.Add("@Title", SqlDbType.NVarChar, 250).Value = notification.Title; cmd.Parameters.Add("@Message", SqlDbType.NVarChar, -1).Value = notification.Message; cmd.Parameters.Add("@Status", SqlDbType.SmallInt).Value = notification.Status; cmd.Parameters.Add("@CreatedBy", SqlDbType.NVarChar, 250).Value = notification.logDetailsObj.CreatedBy; cmd.Parameters.Add("@CreatedDate", SqlDbType.SmallDateTime).Value = notification.logDetailsObj.CreatedDate; statusCode = cmd.Parameters.Add("@StatusOut", SqlDbType.SmallInt); statusCode.Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); operationsStatusObj = new OperationsStatus(); switch (statusCode.Value.ToString()) { case "0": // not Successfull operationsStatusObj.StatusCode = Int16.Parse(statusCode.Value.ToString()); operationsStatusObj.StatusMessage = constObj.InsertFailure; break; case "1": //Insert Successfull operationsStatusObj.StatusCode = Int16.Parse(statusCode.Value.ToString()); operationsStatusObj.StatusMessage = constObj.InsertSuccess; break; default: break; } } } } catch (Exception ex) { operationsStatusObj.StatusMessage = ex.Message; throw ex; } return(operationsStatusObj); }
public OperationsStatus InsertQuotations(Quotations quotationsObj) { OperationsStatus operationsStatusObj = new OperationsStatus(); try { SqlParameter statusCode = null; using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[InsertQuotations]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@QuotationDate", SqlDbType.SmallDateTime).Value = quotationsObj.logDetails.CreatedDate; cmd.Parameters.Add("@ProductID", SqlDbType.Int).Value = quotationsObj.ProductID; cmd.Parameters.Add("@CustomerID", SqlDbType.Int).Value = quotationsObj.CustomerID; cmd.Parameters.Add("@RequiredDate", SqlDbType.SmallDateTime).Value = quotationsObj.RequiredDate; cmd.Parameters.Add("@SourceIP", SqlDbType.NVarChar, 50).Value = quotationsObj.SourceIP; cmd.Parameters.Add("@Message", SqlDbType.NVarChar, -1).Value = quotationsObj.Message; cmd.Parameters.Add("@ProductSpecXML", SqlDbType.Xml).Value = _attributesRepository.GetAttributeXML(quotationsObj.AttributeValues); cmd.Parameters.Add("@CreatedBy", SqlDbType.NVarChar, 250).Value = quotationsObj.logDetails.CreatedBy; cmd.Parameters.Add("@CreatedDate", SqlDbType.SmallDateTime).Value = quotationsObj.logDetails.CreatedDate; statusCode = cmd.Parameters.Add("@StatusOut", SqlDbType.SmallInt); statusCode.Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); switch (statusCode.Value.ToString()) { case "0": operationsStatusObj.StatusCode = Int16.Parse(statusCode.Value.ToString()); operationsStatusObj.StatusMessage = constObj.InsertFailure; break; case "1": operationsStatusObj.StatusCode = Int16.Parse(statusCode.Value.ToString()); operationsStatusObj.StatusMessage = constObj.InsertSuccess; break; default: break; } } } } catch (Exception ex) { throw ex; } return(operationsStatusObj); }
public OperationsStatus UpdateAttributeSet(AttributeSet attributeSetObj, int ID) { OperationsStatus operationsStatusObj = null; try { SqlParameter outparameter = null; using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[UpdateAttributeSet]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ID", SqlDbType.Int).Value = ID; cmd.Parameters.Add("@Name", SqlDbType.NVarChar, 250).Value = attributeSetObj.Name; cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar, 250).Value = attributeSetObj.commonObj.UpdatedBy; cmd.Parameters.Add("@UpdatedDate", SqlDbType.DateTime).Value = attributeSetObj.commonObj.UpdatedDate; outparameter = cmd.Parameters.Add("@Status", SqlDbType.SmallInt); outparameter.Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); operationsStatusObj = new OperationsStatus(); switch (outparameter.Value.ToString()) { case "0": operationsStatusObj.StatusCode = Int16.Parse(outparameter.Value.ToString()); operationsStatusObj.StatusMessage = ConstObj.UpdateFailure; break; case "1": operationsStatusObj.StatusCode = Int16.Parse(outparameter.Value.ToString()); operationsStatusObj.StatusMessage = ConstObj.UpdateSuccess; break; case "2": operationsStatusObj.StatusCode = Int16.Parse(outparameter.Value.ToString()); operationsStatusObj.StatusMessage = ConstObj.Duplicate; break; default: break; } } } } catch (Exception ex) { throw ex; } return(operationsStatusObj); }
public OperationsStatus CustomerEnableORDisable(Customer customer) { OperationsStatus operationsStatusObj = new OperationsStatus(); try { SqlParameter statusCode = null; SqlParameter OutFlag = null; using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[ActivateORDeactivateCustomer]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@CustomerID", SqlDbType.Int).Value = customer.ID; cmd.Parameters.Add("@ActivateFlag", SqlDbType.Bit).Value = customer.IsActive; cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar, 250).Value = customer.logDetailsObj.UpdatedBy; cmd.Parameters.Add("@UpdatedDate", SqlDbType.SmallDateTime).Value = customer.logDetailsObj.UpdatedDate; statusCode = cmd.Parameters.Add("@Status", SqlDbType.SmallInt); OutFlag = cmd.Parameters.Add("@OutFlag", SqlDbType.Bit); OutFlag.Direction = ParameterDirection.Output; statusCode.Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); switch (statusCode.Value.ToString()) { case "0": operationsStatusObj.StatusCode = Int16.Parse(statusCode.Value.ToString()); operationsStatusObj.StatusMessage = constObj.UpdateFailure; break; case "1": operationsStatusObj.StatusCode = Int16.Parse(statusCode.Value.ToString()); operationsStatusObj.StatusMessage = constObj.UpdateSuccess; operationsStatusObj.ReturnValues = OutFlag.Value; break; default: break; } } } } catch (Exception ex) { operationsStatusObj.StatusMessage = ex.Message; throw ex; } return(operationsStatusObj); }
public OperationsStatus UpdateBookings(Bookings bookingsObj) { OperationsStatus operationsStatusObj = new OperationsStatus(); try { SqlParameter statusCode = null; using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[UpdateBookings]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ID", SqlDbType.Int).Value = bookingsObj.ID; cmd.Parameters.Add("@BookingStatus", SqlDbType.Int).Value = bookingsObj.Status; cmd.Parameters.Add("@Price", SqlDbType.Decimal).Value = bookingsObj.Price; cmd.Parameters.Add("@AdditionalCharges", SqlDbType.Decimal).Value = bookingsObj.AdditionalCharges; cmd.Parameters.Add("@TaxAmt", SqlDbType.Decimal).Value = bookingsObj.TaxAmt; cmd.Parameters.Add("@DiscountAmt", SqlDbType.Decimal).Value = bookingsObj.DiscountAmt; cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar, 250).Value = bookingsObj.logDetails.UpdatedBy; cmd.Parameters.Add("@UpdatedDate", SqlDbType.SmallDateTime).Value = bookingsObj.logDetails.UpdatedDate; statusCode = cmd.Parameters.Add("@Status", SqlDbType.SmallInt); statusCode.Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); switch (statusCode.Value.ToString()) { case "0": operationsStatusObj.StatusCode = Int16.Parse(statusCode.Value.ToString()); operationsStatusObj.StatusMessage = constObj.UpdateFailure; break; case "1": operationsStatusObj.StatusCode = Int16.Parse(statusCode.Value.ToString()); operationsStatusObj.StatusMessage = constObj.UpdateSuccess; operationsStatusObj.ReturnValues = bookingsObj.ID; break; default: break; } } } } catch (Exception ex) { throw ex; } return(operationsStatusObj); }
public OperationsStatus UpdatePositionNo(Categories CategoryObj) { OperationsStatus operationsStatusObj = new OperationsStatus(); try { SqlParameter outparameter = null; using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[UpdateCategoryLink]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ID", SqlDbType.Int).Value = CategoryObj.ID; cmd.Parameters.Add("@PositionNo", SqlDbType.Float).Value = CategoryObj.PositionNo; cmd.Parameters.Add("@ProductID", SqlDbType.Int).Value = CategoryObj.ProductID; cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar, 250).Value = CategoryObj.commonObj.UpdatedBy; cmd.Parameters.Add("@UpdatedDate", SqlDbType.SmallDateTime).Value = CategoryObj.commonObj.UpdatedDate; outparameter = cmd.Parameters.Add("@Status", SqlDbType.SmallInt); outparameter.Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); switch (outparameter.Value.ToString()) { case "0": // not Successfull operationsStatusObj.StatusCode = Int16.Parse(outparameter.Value.ToString()); operationsStatusObj.StatusMessage = ConstObj.UpdateFailure; break; case "1": //Insert Successfull operationsStatusObj.StatusCode = Int16.Parse(outparameter.Value.ToString()); operationsStatusObj.StatusMessage = ConstObj.UpdateSuccess; break; default: break; } } } } catch (Exception ex) { throw ex; } return(operationsStatusObj); }
public OperationsStatus InsertInvoiceHeader(Invoice invoiceObj) { OperationsStatus operationsStatusObj = new OperationsStatus(); try { SqlParameter statusCode = null, ID = null; using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[InsertInvoiceHeader]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@InvoiceDate", SqlDbType.DateTime).Value = invoiceObj.LogDetails.CreatedDate; cmd.Parameters.Add("@ParentID", SqlDbType.Int).Value = invoiceObj.ParentID; cmd.Parameters.Add("@ParentType", SqlDbType.NVarChar, 20).Value = invoiceObj.ParentType; cmd.Parameters.Add("@PaymentStatus", SqlDbType.Int).Value = invoiceObj.PaymentStatus; cmd.Parameters.Add("@CreatedBy", SqlDbType.NVarChar, 250).Value = invoiceObj.LogDetails.CreatedBy; cmd.Parameters.Add("@CreatedDate", SqlDbType.DateTime).Value = invoiceObj.LogDetails.CreatedDate; statusCode = cmd.Parameters.Add("@Status", SqlDbType.SmallInt); ID = cmd.Parameters.Add("@ID", SqlDbType.Int); statusCode.Direction = ParameterDirection.Output; ID.Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); switch (statusCode.Value.ToString()) { case "0": operationsStatusObj.StatusCode = Int16.Parse(statusCode.Value.ToString()); operationsStatusObj.StatusMessage = constObj.InsertFailure; break; case "1": operationsStatusObj.StatusCode = Int16.Parse(statusCode.Value.ToString()); operationsStatusObj.StatusMessage = constObj.InsertSuccess; operationsStatusObj.ReturnValues = ID.Value; break; default: break; } } } } catch (Exception ex) { throw ex; } return(operationsStatusObj); }
public OperationsStatus InsertEventTypes(Event EventObj) { OperationsStatus operationsStatusObj = new OperationsStatus(); try { SqlParameter outparameter, outparameter1 = null; using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[InsertEventTypes]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@Name", SqlDbType.NVarChar, 50).Value = EventObj.Name; cmd.Parameters.Add("@RelatedCategoriesCSV", SqlDbType.NVarChar, 250).Value = EventObj.RelatedCategoriesCSV; cmd.Parameters.Add("@EventImageID", SqlDbType.UniqueIdentifier).Value = null;//EventObj.EventImageID; cmd.Parameters.Add("@CreatedBy", SqlDbType.NVarChar, 50).Value = EventObj.commonObj.CreatedBy; cmd.Parameters.Add("@CreatedDate", SqlDbType.DateTime).Value = EventObj.commonObj.CreatedDate; outparameter = cmd.Parameters.Add("@Status", SqlDbType.SmallInt); outparameter.Direction = ParameterDirection.Output; outparameter1 = cmd.Parameters.Add("@ID", SqlDbType.Int); outparameter1.Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); switch (outparameter.Value.ToString()) { case "0": operationsStatusObj.StatusCode = Int16.Parse(outparameter.Value.ToString()); operationsStatusObj.StatusMessage = ConstObj.InsertFailure; break; case "1": operationsStatusObj.StatusCode = Int16.Parse(outparameter.Value.ToString()); operationsStatusObj.StatusMessage = ConstObj.InsertSuccess; operationsStatusObj.ReturnValues = Int32.Parse(outparameter1.Value.ToString()); break; default: break; } } } } catch (Exception ex) { throw ex; } return(operationsStatusObj); }
protected virtual void OnOperationsCompletion() { _stopwatch.Stop(); _operationsStatus = OperationsStatus.Idle; if (FrameworkGlobals.LogsManager.Error != null) { _view.NotifyOperationError(LogMessagesUtils.ReplaceMessageSequencesAndReferences(FrameworkGlobals.MessagesLocalizer.GetString("message_logs_exportation_failure", FrameworkGlobals.ApplicationConfiguration.Language), additionalMessage: FrameworkGlobals.LogsManager.Error.Message)); } }
public OperationsStatus InsertAttributeSetLink(AttributeSetLink attrSetLinkObj) { OperationsStatus operationsStatusObj = null; try { SqlParameter outparameter = null; using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[InsertAttributeSetLink]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@AttributeID", SqlDbType.Int).Value = attrSetLinkObj.AttributeID; cmd.Parameters.Add("@AttributeSetID", SqlDbType.Int).Value = attrSetLinkObj.AttributeSetID; cmd.Parameters.Add("@DisplayOrder", SqlDbType.Float).Value = attrSetLinkObj.DisplayOrder; cmd.Parameters.Add("@CreatedBy", SqlDbType.NVarChar, 250).Value = attrSetLinkObj.commonObj.CreatedBy; cmd.Parameters.Add("@CreatedDate", SqlDbType.DateTime).Value = attrSetLinkObj.commonObj.CreatedDate; outparameter = cmd.Parameters.Add("@Status", SqlDbType.SmallInt); outparameter.Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); operationsStatusObj = new OperationsStatus(); switch (outparameter.Value.ToString()) { case "0": operationsStatusObj.StatusCode = Int16.Parse(outparameter.Value.ToString()); operationsStatusObj.StatusMessage = ConstObj.InsertFailure; break; case "1": operationsStatusObj.StatusCode = Int16.Parse(outparameter.Value.ToString()); operationsStatusObj.StatusMessage = ConstObj.InsertSuccess; operationsStatusObj.ReturnValues = attrSetLinkObj.AttributeSetID; break; default: break; } } } } catch (Exception ex) { throw ex; } return(operationsStatusObj); }
public OperationsStatus InsertEventsLog(EventRequests eventObj) { OperationsStatus operationsStatusObj = new OperationsStatus(); try { SqlParameter outparameter = null; using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[InsertEventsLog]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ParentID", SqlDbType.SmallInt).Value = eventObj.ID; cmd.Parameters.Add("@ParentType", SqlDbType.NVarChar, 20).Value = eventObj.ParentType; cmd.Parameters.Add("@Comment", SqlDbType.NVarChar, -1).Value = eventObj.Comments; cmd.Parameters.Add("@CustomerNotifiedYN", SqlDbType.Bit).Value = null; cmd.Parameters.Add("@CreatedBy", SqlDbType.NVarChar, 50).Value = eventObj.logDetailsObj.CreatedBy; cmd.Parameters.Add("@CreatedDate", SqlDbType.DateTime).Value = eventObj.logDetailsObj.CreatedDate; outparameter = cmd.Parameters.Add("@Status", SqlDbType.SmallInt); outparameter.Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); switch (outparameter.Value.ToString()) { case "0": operationsStatusObj.StatusCode = Int16.Parse(outparameter.Value.ToString()); operationsStatusObj.StatusMessage = ConstObj.InsertFailure; break; case "1": operationsStatusObj.StatusCode = Int16.Parse(outparameter.Value.ToString()); operationsStatusObj.StatusMessage = ConstObj.InsertSuccess; break; default: break; } } } } catch (Exception ex) { throw ex; } return(operationsStatusObj); }
public OperationsStatus UpdateUser(User user) { OperationsStatus operationsStatusObj = new OperationsStatus(); try { SqlParameter statusCode = null; using (SqlConnection con = _databaseFactory.GetDBConnection()) { if (con.State == ConnectionState.Closed) { con.Open(); } using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = con; cmd.CommandText = "[UpdateUser]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ID", SqlDbType.Int).Value = user.ID; cmd.Parameters.Add("@RoleList", SqlDbType.NVarChar, -1).Value = user.RoleList; cmd.Parameters.Add("@UserName", SqlDbType.NVarChar, 250).Value = user.UserName; cmd.Parameters.Add("@Password", SqlDbType.NVarChar, 250).Value = user.Password; cmd.Parameters.Add("@ProfileImageID", SqlDbType.UniqueIdentifier).Value = user.ProfileImageId; cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar, 250).Value = user.logDetails.UpdatedBy; cmd.Parameters.Add("@UpdatedDate", SqlDbType.SmallDateTime).Value = user.logDetails.UpdatedDate; statusCode = cmd.Parameters.Add("@StatusOut", SqlDbType.SmallInt); statusCode.Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); switch (Int16.Parse(statusCode.Value.ToString())) { case 0: // not Successfull operationsStatusObj.StatusMessage = constObj.UpdateFailure; break; case 1: operationsStatusObj.StatusMessage = constObj.UpdateSuccess; operationsStatusObj.ReturnValues = new { UserID = user.ID, }; break; } } } } catch (Exception ex) { throw ex; } return(operationsStatusObj); }
public OperationsStatus UpdateDeliveryStatus(Shipment shipmentObj) { OperationsStatus operationsStatusObj = new OperationsStatus(); try { SqlParameter statusCode = null; using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[UpdateDeliveryStatus]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ID", SqlDbType.Int).Value = shipmentObj.ID; cmd.Parameters.Add("@DeliveredDate", SqlDbType.NVarChar, 250).Value = shipmentObj.DeliveredDate; cmd.Parameters.Add("@DeliveredBy", SqlDbType.NVarChar, 250).Value = shipmentObj.DeliveredBy; cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar, 250).Value = shipmentObj.log.UpdatedBy; cmd.Parameters.Add("@UpdatedDate", SqlDbType.DateTime).Value = shipmentObj.log.UpdatedDate; statusCode = cmd.Parameters.Add("@Status", SqlDbType.SmallInt); statusCode.Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); switch (statusCode.Value.ToString()) { case "0": operationsStatusObj.StatusCode = Int16.Parse(statusCode.Value.ToString()); operationsStatusObj.StatusMessage = constObj.UpdateFailure; break; case "1": operationsStatusObj.StatusCode = Int16.Parse(statusCode.Value.ToString()); operationsStatusObj.StatusMessage = constObj.UpdateSuccess; break; default: break; } } } } catch (Exception ex) { throw ex; } return(operationsStatusObj); }
public OperationsStatus SetDefaultAddress(int CustomerID, int AddressID) { OperationsStatus operationsStatusObj = new OperationsStatus(); try { SqlParameter statusCode = null; using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[SetDefaultAddress]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@CustomerID", SqlDbType.NVarChar, 250).Value = CustomerID; cmd.Parameters.Add("@AddressID", SqlDbType.NVarChar, 250).Value = AddressID; statusCode = cmd.Parameters.Add("@Status", SqlDbType.SmallInt); statusCode.Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); switch (statusCode.Value.ToString()) { case "0": // not Successfull operationsStatusObj.StatusCode = Int16.Parse(statusCode.Value.ToString()); operationsStatusObj.StatusMessage = constObj.UpdateFailure; break; case "1": //Insert Successfull operationsStatusObj.StatusCode = Int16.Parse(statusCode.Value.ToString()); operationsStatusObj.StatusMessage = constObj.UpdateSuccess; break; default: break; } } } } catch (Exception ex) { operationsStatusObj.StatusMessage = ex.Message; throw ex; } return(operationsStatusObj); }
public Customer GetCustomer(int CustomerID, OperationsStatus Status) { Customer CustomerObj = null; try { CustomerObj = _customerRepository.GetCustomer(CustomerID, Status); } catch (Exception) { } return(CustomerObj); }
public OperationsStatus InsertEventsLog(EventRequests eventObj) { OperationsStatus OperationsStatusObj = null; try { OperationsStatusObj = _eventRequestsRepositry.InsertEventsLog(eventObj); } catch (Exception) { } return(OperationsStatusObj); }
public Attributes GetAttributes(int AttributeID, OperationsStatus Status) { Attributes myattribute = null; try { myattribute = _attributesRepository.GetAttributes(AttributeID, Status); } catch (Exception) { } return(myattribute); }
public OperationsStatus UpdateAttributes(Attributes attributesObj) { OperationsStatus OperationsStatusObj = null; try { OperationsStatusObj = _attributesRepository.UpdateAttributes(attributesObj); } catch (Exception) { } return(OperationsStatusObj); }
public OperationsStatus DeleteAttributes(int AttributeID) { OperationsStatus OperationsStatusObj = null; try { OperationsStatusObj = _attributesRepository.DeleteAttributes(AttributeID); } catch (Exception) { } return(OperationsStatusObj); }