Esempio n. 1
0
        static void Main(string[] args)
        {
            if (TransferToACC.EnabledData())
            {
                Console.WriteLine("transfer to acc in progress..");
                TransferToACC obj  = new TransferToACC();
                var           post = TransferToACC.PostData(1); //inventory transfer
                Program.ShowMessage((post == 0) ? "0 Records of inventory transfer" : "inventory " + post + " records transferrd successfully");
                Console.WriteLine("Billing records transfer to acc in progress..");
                var Billingpost = TransferToACC.PostData(2); //billing transfer
                Program.ShowMessage((Billingpost == 0) ? " 0 Records of billing transfer" : "Billing " + Billingpost + " records transferrd successfully");
                Console.WriteLine("Pharmacy records transfer to acc in progress..");
                var Pharmacypost = TransferToACC.PostData(3); //pharmacy transfer
                Program.ShowMessage((Pharmacypost == 0) ? "0 Records of pharmacy transfer" : "Pharmacy " + Pharmacypost + " records transferrd successfully");

                if (post >= 0 && Pharmacypost >= 0 && Billingpost >= 0)
                {
                    Console.WriteLine("transferred successfully");
                }
                else
                {
                    Console.WriteLine("transfer failed");
                }
            }
            else
            {
                Console.WriteLine("Automatic transfer not allowed!! Please contact administrator to enable Automatic Accounting Transfer...");
            }
        }
Esempio n. 2
0
 //check enabled automatic transfer to accounting
 public static bool EnabledData()
 {
     try
     {
         var           con           = TransferToACC.getConnection(accConn); // decrypted connectionstring;
         CoreDbContext coreDbContext = new CoreDbContext(con);
         var           result        = (from par in coreDbContext.Parameters
                                        where (par.ParameterGroupName == "Accounting" && par.ParameterName == "AccountingTransfer")
                                        select par.ParameterValue).FirstOrDefault();
         var data  = (JObject)JsonConvert.DeserializeObject(result);
         var check = data["AutomaticTransfer"].Value <string>();
         if (check == "True")
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
         return(false);
     }
 }