/// <summary> /// Current time and Global UserID is the default vaues saved. with shipmentID /// </summary> /// <param name="ActionType">String</param> /// <param name="ShipmentID">String</param> /// <returns>Boolean true or false</returns> public static Boolean logThis(String ActionType, String ShipmentID) { Boolean _return = false; Thread T = new Thread(() => { try { List <cstAutditLog> _UserLog = new List <cstAutditLog>(); cstAutditLog _UserC = new cstAutditLog(); _UserC.UserLogID = Guid.Empty; _UserC.UserID = Global.LoggedUserId; _UserC.ActionType = ActionType; _UserC.ActionTime = Convert.ToDateTime(DateTime.UtcNow.ToString()); _UserC.ActionValue = ShipmentID; _UserLog.Add(_UserC); _return = Global.controller.SaveUserLog(_UserLog); } catch (Exception Ex) { ErrorLoger.save("Classes\\LogThis(3)", Ex.InnerException.ToString()); } }); T.Start(); return(_return); }
/// <summary> /// save User log with ShipmentID /// </summary> /// <param name="UserID">String</param> /// <param name="ActionType">String</param> /// <param name="ActionTime">String</param> /// <param name="ShipmentID">String</param> /// <returns></returns> public static Boolean logThis(string UserID, String ActionType, String ActionTime, String ShipmentID) { Boolean _return = false; Thread T = new Thread(() => { try { List <cstAutditLog> _UserLog = new List <cstAutditLog>(); cstAutditLog _UserC = new cstAutditLog(); _UserC.UserLogID = Guid.Empty; Guid TUserID = Guid.Empty; Guid.TryParse(UserID.ToString(), out TUserID); _UserC.UserID = TUserID; _UserC.ActionType = ActionType; _UserC.ActionTime = Convert.ToDateTime(ActionTime); _UserC.ActionValue = ShipmentID; _UserLog.Add(_UserC); _return = Global.controller.SaveUserLog(_UserLog); } catch (Exception Ex) { ErrorLoger.save("Classes\\LogThis(2)", Ex.InnerException.ToString()); } }); return(_return); }
/// <summary> /// Avinash /// Split the Time returned from locationsetting File in to hours , Min, Sec /// </summary> /// <param name="returnHHorMMorSS">String maintion HH to return Hour value same for Min-MM and for Sec value =SS</param> /// <returns>String depending on selection</returns> public static string GetHrorMinorSec(String returnHHorMMorSS) { String _retuen = ""; try { String _Time = cmdLocalFile.ReadString("LogoutTime"); if (_Time != null || _Time != "") { var Str = _Time.Split(new Char[] { ':' }); switch (returnHHorMMorSS) { case "HH": _retuen = Str[0]; break; case "MM": _retuen = Str[1]; break; case "SS": _retuen = Str[2]; break; default: break; } } } catch (Exception Ex) { ErrorLoger.save("Classes\\AutoLogoutTime.GetHrorMinOrSec()", Ex.InnerException.ToString()); } return(_retuen); }
/// <summary> /// Adjest Print Page settinges here. /// Add Bodcodes, Lines spaces etc /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void pd_PrintPage(object sender, PrintPageEventArgs e) { try { System.Drawing.Font drawFont = new System.Drawing.Font("Arial", 10); System.Drawing.SolidBrush drawBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black); //Box Number Image Borcode e.Graphics.DrawImage(imgBoxNumber, 10, 10, (float)200, 50); //Box Number e.Graphics.DrawString(BoxNumber.ToString(), drawFont, drawBrush, (float)50, (float)60.5); //packing Number and Barcode e.Graphics.DrawImage(imgPackingNumber, 10, 100, (float)200, (float)50); //Packing Number String e.Graphics.DrawString(PackingNumber.ToString(), drawFont, drawBrush, (float)50, (float)150.5); //shipment Number and its barcode e.Graphics.DrawImage(imgShippingNumber, 10, 190, (float)200, (float)50); //Shipment Number String e.Graphics.DrawString(ShippingNumber, drawFont, drawBrush, (float)50, (float)240.5); //Border to paper boundry System.Drawing.Pen pen = new System.Drawing.Pen(drawBrush); e.Graphics.DrawRectangle(pen, (float)0.0, (float)0.0, (float)288.0, (float)432.0); } catch (Exception Ex) { //Log the Error to the Error Log table ErrorLoger.save("wndShipmentDetailPage - pd_PrintPage", "[" + DateTime.UtcNow.ToString() + "]" + Ex.ToString(), DateTime.UtcNow, Global.LoggedUserId); } }
/// <summary> /// Print packing slip of barcode that has packing number and its respective shipping number; /// </summary> public void PrintPckingSlip(Guid BoxID) { try { cstBoxPackage _boxInfo = Global.controller.GetBoxPackageByBoxID(BoxID); BoxNumber = _boxInfo.BOXNUM; cstPackageTbl packing = Global.controller.GetPackingTbl().SingleOrDefault(i => i.PackingId == _boxInfo.PackingID); ShippingNumber = packing.ShippingNum; BarcodeLib.Barcode b = new BarcodeLib.Barcode(); PackingNumber = packing.PCKROWID; try { imgPackingNumber = b.Encode(BarcodeLib.TYPE.CODE128, packing.PCKROWID, System.Drawing.Color.Black, System.Drawing.Color.White, 300, 60); imgShippingNumber = b.Encode(BarcodeLib.TYPE.CODE128, ShippingNumber, System.Drawing.Color.Black, System.Drawing.Color.White, 300, 60); imgBoxNumber = b.Encode(BarcodeLib.TYPE.CODE128, BoxNumber, System.Drawing.Color.Black, System.Drawing.Color.White, 300, 60); } catch (Exception Ex) { //Log the Error to the Error Log table ErrorLoger.save("wndShipmentDetailPage - PrintPckingSlip_sub1", "[" + DateTime.UtcNow.ToString() + "]" + Ex.ToString(), DateTime.UtcNow, Global.LoggedUserId); } PrintDocument pd = new PrintDocument(); pd.DefaultPageSettings.Margins = new Margins(0, 0, 0, 0); pd.OriginAtMargins = false; pd.DefaultPageSettings.Landscape = true; //Business card paper size pd.DefaultPageSettings.PaperSize = new PaperSize("BC", 330, 220); pd.PrintPage += new PrintPageEventHandler(pd_PrintPage); pd.Print(); } catch (Exception Ex) { //Log the Error to the Error Log table ErrorLoger.save("wndShipmentDetailPage - PrintPckingSlip", "[" + DateTime.UtcNow.ToString() + "]" + Ex.ToString(), DateTime.UtcNow, Global.LoggedUserId); } }
/// <summary> /// Session initialized to the application specified time and strated. /// </summary> public static void StartTime() { try { Global.TimeOutUserName = Global.LoggedUserModel.UserInfo.UserName; Global.ISTimerRaised = false; int _Hour = Convert.ToInt32(GetHrorMinorSec("HH")); int _Min = Convert.ToInt32(GetHrorMinorSec("MM")); int _Sec = Convert.ToInt32(GetHrorMinorSec("SS")); //AtutoTimer if (Autotimer.IsEnabled) { Autotimer.Stop(); } Autotimer.Interval = new TimeSpan(_Hour, _Min, _Sec); Autotimer.Start(); } catch (Exception Ex) { ErrorLoger.save("Classes\\AutologoutTime.StartTime()", Ex.InnerException.ToString()); } }