public Models.SafariInfo GetSafariInfoByOrderId(string OrderId) { DataTable dt = new DataTable(); Models.SafariInfo SafariInfo = new Models.SafariInfo(); try { dt = _orderData.GetSafariInfoByOrderId(OrderId); foreach (DataRow record in dt.Rows) { SafariInfo = new Models.SafariInfo() { Id = record["Id"].ToString(), OrderId = record["OrderId"].ToString(), CreatedDate = record["CreatedDate"].ToString(), Length = record["Length"].ToString(), Shoulder = record["Shoulder"].ToString(), S_Length = record["S_Length"].ToString(), S_Loose = record["S_Loose"].ToString(), Chest = record["Chest"].ToString(), Waist = record["Waist"].ToString(), Hip = record["Hip"].ToString(), Collar = record["Collar"].ToString(), Collar_Style = record["Collar_Style"].ToString(), Buttons = record["Buttons"].ToString(), Side_Vent = record["Side_Vent"].ToString(), S_Breast = record["S_Breast"].ToString(), D_Breast = record["D_Breast"].ToString(), Breast = record["Breast"].ToString(), Notes = record["Notes"].ToString(), ModifiedDate = record["ModifiedDate"].ToString() }; } } catch (Exception) { } return(SafariInfo); }
public bool Update(string Id, string BillNumber, string CustomerName, string Image, string ShopId, int Amount, string CustomerMobileNumber, string Status, string Notes, DateTime StartDate, DateTime EndDate, Models.SafariInfo safariInfo, Models.PantInfo pantInfo, Models.ShirtInfo shirtInfo) { bool Result = false; try { Result = _orderData.Update(Id, BillNumber, CustomerName, Image, ShopId, Amount, CustomerMobileNumber, Status, Notes, StartDate, EndDate); if (Result) { if (safariInfo != null) { _orderData.DeleteSafariInfoByOrderId(Id); safariInfo.Id = Guid.NewGuid().ToString(); safariInfo.OrderId = Id; Result = _orderData.AddSafariInfo(safariInfo.Id, safariInfo.OrderId, safariInfo.Length, safariInfo.Shoulder, safariInfo.S_Length, safariInfo.S_Loose, safariInfo.Chest, safariInfo.Waist, safariInfo.Hip, safariInfo.Collar, safariInfo.Collar_Style, safariInfo.Buttons, safariInfo.Side_Vent, safariInfo.S_Breast, safariInfo.D_Breast, safariInfo.Breast, safariInfo.Notes); } if (Result) { if (pantInfo != null) { _orderData.DeletePantiInfoByOrderId(Id); pantInfo.Id = Guid.NewGuid().ToString(); pantInfo.OrderId = Id; Result = _orderData.AddPantInfo(pantInfo.Id, pantInfo.OrderId, pantInfo.Length, pantInfo.Seat, pantInfo.Hip, pantInfo.InSeen, pantInfo.Thigh, pantInfo.Knee, pantInfo.Bottom, pantInfo.BackPocket, pantInfo.WatchPocket, pantInfo.Iron, pantInfo.Emming, pantInfo.BottomFold, pantInfo.BuckleModel, pantInfo.HookButton, pantInfo.Button, pantInfo.Notes); } if (Result) { if (shirtInfo != null) { _orderData.DeleteShirtInfoByOrderId(Id); shirtInfo.Id = Guid.NewGuid().ToString(); shirtInfo.OrderId = Id; Result = _orderData.AddShirtInfo(shirtInfo.Id, shirtInfo.OrderId, shirtInfo.Length, shirtInfo.Shoulder, shirtInfo.S_Length, shirtInfo.S_Loose, shirtInfo.Chest, shirtInfo.Waist, shirtInfo.Hip, shirtInfo.Collar, shirtInfo.Collar_Size, shirtInfo.Collar_Style, shirtInfo.Cuf_Size, shirtInfo.Cuf_Style, shirtInfo.Collar_Button, shirtInfo.Patti, shirtInfo.Pocket, shirtInfo.InnerPocket, shirtInfo.KneePatch, shirtInfo.Fit, shirtInfo.Notes); } } } } } catch (Exception) { } return(Result); }
public ActionResult UpdateOrderInfo(string Id, string BillNumber, string CustomerName, string Image, string ShopId, int Amount, string CustomerMobileNumber, string Status, string Notes, string StartDate, string EndDate, Models.SafariInfo safariInfo, Models.PantInfo pantInfo, Models.ShirtInfo shirtInfo) { Dictionary <string, object> returnObject = new Dictionary <string, object>(); try { bool Result = false; DateTime StartDateVal = DateTime.Parse(StartDate); DateTime EndDateVal = DateTime.Parse(EndDate); var OrderInfo = _orderUtility.GetOrderInfoById(Id); if (string.IsNullOrEmpty(Image)) { Image = OrderInfo.Image; } else { string path = Server.MapPath("~" + Globals.Default_OrderImagePath); //Path //Check if directory exist if (!System.IO.Directory.Exists(path)) { System.IO.Directory.CreateDirectory(path); //Create directory if it doesn't exist } string imageName = Guid.NewGuid().ToString() + ".jpg"; //set the image path string imgPath = Path.Combine(path, imageName); var splitedValue = Image.Split(','); var ReplaceValue = splitedValue[0] + ','; Image = Image.Replace(ReplaceValue, ""); var imageBytes = Convert.FromBase64String(Image); System.IO.File.WriteAllBytes(imgPath, imageBytes); Image = Globals.Default_OrderImagePath + "/" + imageName; } Result = _orderUtility.Update(Id, BillNumber, CustomerName, Image, ShopId, Amount, CustomerMobileNumber, Status, Notes, StartDateVal, EndDateVal, safariInfo, pantInfo, shirtInfo); if (Result == true) { returnObject.Add("status", "success"); } else { returnObject.Add("status", "fail"); } } catch (Exception) { } return(Json(new { message = returnObject }, JsonRequestBehavior.AllowGet)); }