public static async void NotifyStaffAttandance(AprajitaRetailsContext db, string StaffName, int empId, AttUnits status, string time) { return; var emp = BotUser.GetEmp(db, empId); if (emp != null) { string msg = "StaffName: " + StaffName + " is "; if (status == AttUnits.Present) { msg += "present and entry time is " + time + "."; } else if (status == AttUnits.Absent) { msg += "absent."; } else if (status == AttUnits.HalfDay) { msg += "present and entry time is " + time + " and marked as Half day "; } else if (status == AttUnits.Sunday) { msg += "present and entry time is " + time + ", and Sunday is marked."; } msg += " (Date:" + DateTime.Now + ")."; await BotGini.SendMessage(emp.ChatId, msg); await BotGini.SendMessage(BotConfig.AmitKumarChatId, msg); } else { string msg = "StaffName: " + StaffName + " is "; if (status == AttUnits.Present) { msg += "present and entry time is " + time + "."; } else if (status == AttUnits.Absent) { msg += "absent."; } else if (status == AttUnits.HalfDay) { msg += "present and entry time is " + time + " and marked as Half day "; } else if (status == AttUnits.Sunday) { msg += "present and entry time is " + time + ", and Sunday is marked."; } msg += " (Date:" + DateTime.Now + ")."; await BotGini.SendMessage(BotConfig.AmitKumarChatId, msg); } }
public static async void OnMessageHandler(object sender, MessageEventArgs e) { await BotGini.SendMessage(e.Message.Chat.Id, "We got Message from you, We are processing Kindly wait...."); if (e.Message.Text != null) { switch (e.Message.Text) { case "/": break; case "/ATT": break; case "/sale": break; case "/todaysale": break; case "/yearlysale": break; case "/incentive": break; case "/LP": break; case "/staffinfo": break; case "/myInfo": break; case "/register": await BotGini.SendMessage(e.Message.Chat.Id, "type /mobile space your-mobile-no, your-password"); break; case "/help": await BotGini.SendMessage(e.Message.Chat.Id, "Helping"); break; default: await BotGini.SendMessage(e.Message.Chat.Id, "You Said:" + e.Message.Text); break; } } }
public async Task <IActionResult> Index(string TXTMessage) { if (!string.IsNullOrEmpty(TXTMessage)) { bot = new BotGini(); bot.SetupGini(); ViewBag.SendMessage = TXTMessage + ViewBag.SendMessage; await BotGini.SendMessage(LastChatId, TXTMessage); // ViewBag.RecMessage = Msg; } return(View()); }
public static BotUser GetEmp(AprajitaRetailsContext db, int empId) { if (!BotGini.IsGiniRunning()) { Gini.Start(); } BotUser emp = db.TelegramAuthUsers.Where(c => c.EmployeeId == empId).Select(c => new BotUser { MobileNo = c.MobileNo, ChatId = c.TelegramChatId }).FirstOrDefault(); return(emp); }
public static BotUser GetEmp(AprajitaRetailsContext db, int staffId, bool IsStaffId) { if (!BotGini.IsGiniRunning()) { Gini.Start(); } string StaffName = db.Salesmen.Find(staffId).SalesmanName; BotUser emp = db.TelegramAuthUsers.Where(c => c.TelegramUserName == StaffName).Select(c => new BotUser { MobileNo = c.MobileNo, ChatId = c.TelegramChatId, StaffName = c.TelegramUserName }).FirstOrDefault(); if (emp == null) { emp = new BotUser { StaffName = StaffName }; } return(emp); }
public static async void NotifySale(AprajitaRetailsContext db, int staffId, decimal amount) { return; var emp = BotUser.GetEmp(db, staffId, true); if (emp != null) { string msg = $"({emp.StaffName}): You have made a Sale of Amount Rs. " + amount + " on date " + DateTime.Now; await BotGini.SendMessage(emp.ChatId, msg); await BotGini.SendMessage(BotConfig.AmitKumarChatId, msg); } else { string msg = $"{emp.StaffName} had made a Sale of Amount Rs. " + amount + " on date " + DateTime.Now; await BotGini.SendMessage(BotConfig.AmitKumarChatId, msg); } }
public static async void NotifyStaffPayment(AprajitaRetailsContext db, string StaffName, int empId, decimal amount, string remarks, bool IsRec = false) { return; var emp = BotUser.GetEmp(db, empId); if (emp != null) { string msg = ""; if (IsRec) { msg = "We had received from StaffName: " + StaffName + "of Amount: Rs. " + amount + "in respect to " + remarks + ". If you found amount is not correct kindly report."; } else { msg = "Payment is made to StaffName: " + StaffName + "of Amount: Rs. " + amount + "in respect to " + remarks + ". If you found amount is not correct kindly report."; } msg += " (Date:" + DateTime.Today.Date + ")."; await BotGini.SendMessage(emp.ChatId, msg); await BotGini.SendMessage(BotConfig.AmitKumarChatId, msg); } else { string msg = ""; if (IsRec) { msg = "We had received from StaffName: " + StaffName + "of Amount: Rs. " + amount + "in respect to " + remarks + ". If you found amount is not correct kindly report."; } else { msg = "Payment is made to StaffName: " + StaffName + "of Amount: Rs. " + amount + "in respect to " + remarks + ". If you found amount is not correct kindly report."; } msg += " (Date:" + DateTime.Today.Date + ")."; await BotGini.SendMessage(BotConfig.AmitKumarChatId, msg); } }