public SupportabilityUploader(SAP.Net.Http.HttpClient client, bool uploadBtx = true)
        {
            if (client == null) throw new ArgumentNullException("client");

            this.urlPostfix = uploadBtx ? "btx" : "clientlogs";
            this.clientRef = client;
        }
示例#2
0
 public void ComputeAWTs(float reliabilityFactor)
 {
     foreach (Stop SAP in this.nearestSAP)
     {
         SAP.ComputeAWTs(reliabilityFactor);
     }
 }
示例#3
0
        public async Task <MsgRetriever> WebSAPAcctMaint(SAP _SAP)
        {
            var objDataEngine = new FleetDataEngine(AccessMode.CardHolder, DBType.Maint);

            objDataEngine.InitiateConnection();
            SqlParameter[] Parameters = new SqlParameter[17];
            SqlCommand     cmd        = new SqlCommand();

            Parameters[1] = String.IsNullOrEmpty(_SAP.SapNo) ? new SqlParameter("@SapNo", DBNull.Value) : new SqlParameter("@SapNo", _SAP.SapNo);
            Parameters[2] = String.IsNullOrEmpty(_SAP.SourceRefNo) ? new SqlParameter("@SourceRefNo", DBNull.Value) : new SqlParameter("@SourceRefNo", _SAP.SourceRefNo);
            Parameters[3] = String.IsNullOrEmpty(_SAP.RefKey) ? new SqlParameter("@RefKey", DBNull.Value) : new SqlParameter("@RefKey", _SAP.RefKey);
            Parameters[4] = String.IsNullOrEmpty(_SAP.RefTo) ? new SqlParameter("@RefTo", DBNull.Value) : new SqlParameter("@RefTo", _SAP.RefTo);
            Parameters[5] = String.IsNullOrEmpty(_SAP.AccountName) ? new SqlParameter("@AcctName", DBNull.Value) : new SqlParameter("@AcctName", _SAP.AccountName);
            Parameters[6] = String.IsNullOrEmpty(_SAP.SelectedAccountGroup) ? new SqlParameter("@AcctGroup", DBNull.Value) : new SqlParameter("@AcctGroup", _SAP.SelectedAccountGroup);
            Parameters[7] = String.IsNullOrEmpty(_SAP.TaxId) ? new SqlParameter("@TaxId", DBNull.Value) : new SqlParameter("@TaxId", _SAP.TaxId);
            Parameters[8] = String.IsNullOrEmpty(_SAP.SelectedWithHoldingTax) ? new SqlParameter("@Wht", DBNull.Value) : new SqlParameter("@Wht", _SAP.SelectedWithHoldingTax);
            Parameters[9] = String.IsNullOrEmpty(_SAP.PayeeName) ? new SqlParameter("@PayeeName", DBNull.Value) : new SqlParameter("@PayeeName", _SAP.PayeeName);

            Parameters[10] = String.IsNullOrEmpty(_SAP.SelectedPayeeCd) ? new SqlParameter("@PayeeCd", DBNull.Value) : new SqlParameter("@PayeeCd", _SAP.SelectedPayeeCd);

            Parameters[11] = String.IsNullOrEmpty(_SAP.OldRefKey) ? new SqlParameter("@PrevRefKey", DBNull.Value) : new SqlParameter("@PrevRefKey", _SAP.OldRefKey);

            Parameters[12] = String.IsNullOrEmpty(_SAP.Remarks) ? new SqlParameter("@Remarks", DBNull.Value) : new SqlParameter("@Remarks", _SAP.Remarks);

            Parameters[13] = String.IsNullOrEmpty(_SAP.CreatedBy) ? new SqlParameter("@CreatedBy", DBNull.Value) : new SqlParameter("@CreatedBy", _SAP.CreatedBy);

            Parameters[14] = String.IsNullOrEmpty(_SAP.CreationDate) ? new SqlParameter("@CreationDate", DBNull.Value) : new SqlParameter("@CreationDate", BaseClass.ConvertDatetimeDB(_SAP.CreationDate));

            Parameters[15] = String.IsNullOrEmpty(this.GetUserId) ? new SqlParameter("@UserId", DBNull.Value) : new SqlParameter("@UserId", this.GetUserId);

            Parameters[16] = new SqlParameter("@LastUpdDate", ConvertDatetimeDB(DateTime.Now.ToString()));


            Parameters[0]           = new SqlParameter("@RETURN_VALUE", SqlDbType.BigInt);
            Parameters[0].Direction = ParameterDirection.ReturnValue;


            var Cmd    = objDataEngine.ExecuteWithReturnValue("[WebSAPAcctMaint]", CommandType.StoredProcedure, Parameters);
            var Result = Convert.ToInt32(Cmd.Parameters["@RETURN_VALUE"].Value);
            var Descp  = GetMessageCode(Result);

            objDataEngine.CloseConnection();
            return(await Descp);
        }
示例#4
0
        public async Task <SAP> SAPGetAccount(string SapNo)
        {
            var objDataEngine = new FleetDataEngine(AccessMode.CustomerService, DBType.Maint);

            objDataEngine.InitiateConnection();
            SqlParameter[] Parameters = new SqlParameter[1];
            Parameters[0] = String.IsNullOrEmpty(SapNo) ? new SqlParameter("@sapNo", DBNull.Value) : new SqlParameter("@sapNo", SapNo);

            var execResult  = objDataEngine.ExecuteCommand("WebSAPAcctSelect", CommandType.StoredProcedure, Parameters);
            var _SAPAccount = new SAP();

            while (execResult.Read())
            {
                _SAPAccount.Id                     = Convert.ToString(execResult["Id"]);
                _SAPAccount.SapNo                  = Convert.ToString(execResult["SAPNo"]);
                _SAPAccount.SourceRefNo            = Convert.ToString(execResult["SourceRefNo"]);
                _SAPAccount.RefKey                 = Convert.ToString(execResult["RefKey"]);
                _SAPAccount.RefTo                  = Convert.ToString(execResult["RefTo"]);
                _SAPAccount.AccountName            = Convert.ToString(execResult["AccountName"]);
                _SAPAccount.SelectedAccountGroup   = Convert.ToString(execResult["AccountGroup"]);
                _SAPAccount.TaxId                  = Convert.ToString(execResult["TaxId"]);
                _SAPAccount.SelectedWithHoldingTax = Convert.ToString(execResult["WithholdingTax"]);
                _SAPAccount.PayeeName              = Convert.ToString(execResult["PayeeName"]);
                _SAPAccount.SelectedPayeeCd        = Convert.ToString(execResult["PayeeCd"]);
                _SAPAccount.OldRefKey              = Convert.ToString(execResult["OldRefKey"]);
                _SAPAccount.Remarks                = Convert.ToString(execResult["Remarks"]);
                _SAPAccount.CreatedBy              = Convert.ToString(execResult["CreatedBy"]);
                _SAPAccount.CreationDate           = Convert.ToString(execResult["CreationDate"]);
                _SAPAccount.UserId                 = Convert.ToString(execResult["UserId"]);
                _SAPAccount.LastUpdate             = Convert.ToString(execResult["LastUpdateDate"]);
                _SAPAccount.AccountGroup           = await BaseClass.WebGetRefLib("City");

                _SAPAccount.PayeeCd = await BaseClass.WebGetRefLib("City");

                _SAPAccount.WithHoldingTax = await BaseClass.WebGetRefLib("City");
            }

            objDataEngine.CloseConnection();
            return(_SAPAccount);
        }
示例#5
0
        private void button8_Click_1(object sender, EventArgs e)
        {
            string username, password;

            username = SAU.Text;
            password = SAP.Text;
            username.Trim();
            password.Trim();

            if (checkerA(username, password) == false)
            {
                MessageBox.Show("Wrong Username Or Password");
                SAU.Clear();
                SAP.Clear();
            }
            else
            {
                Form6 f6 = new Form6();
                this.Hide();
                f6.ShowDialog();
                this.Close();
            }
        }
示例#6
0
 /// <summary>
 /// Currently we know only one model, so no parameters are required,
 /// and we are always returning ALIModel object specifically.
 /// </summary>
 /// <returns></returns>
 public static AliModel GenerateModel(string modelType)
 {
     return(SAP._GenerateModelInternal(modelType));
 }
        static void Main()
        {
            try
            {
                string[] arg    = Environment.GetCommandLineArgs();
                string   conStr = "";

                if (arg.Length >= 2)
                {
                    conStr = arg[1];
                }

                //conStr = "runjob";
                //conStr = "-capture";

                if (conStr.ToLower() == "runjob")
                {
                    #region runjob
                    try
                    {
                        string connStr = "";
                        string dbName  = "";

                        SAP sap = new SAP();
                        SAP.bRunJob = true;

                        if (sap.connectToDB())
                        {
                            sap.ProcessJob();
                            SAP.errorLog("eBizCharge job run completed.");
                            sap.CloseConnect();
                        }
                    }
                    catch (Exception ex)
                    {
                        SAP.errorLog(ex);
                    }
                    finally
                    {
                        System.Environment.Exit(0);
                    }
                    #endregion
                }
                if (conStr.ToLower() == "-capture")
                {
                    #region -capture
                    try
                    {
                        SAP sap = new SAP();
                        SAP.bRunJob = true;
                        if (sap.connectToDB())
                        {
                            sap.captureService();

                            sap.CloseConnect();
                        }
                    }
                    catch (Exception ex)
                    {
                        SAP.errorLog(ex);
                    }
                    finally
                    {
                        System.Environment.Exit(0);
                    }
                    #endregion
                }
                if (conStr.ToLower() == "-nodeliverycapture")
                {
                    #region nodeliverycapture
                    try
                    {
                        SAP sap = new SAP();
                        SAP.bRunJob = true;
                        if (sap.connectToDB())
                        {
                            while (true)
                            {
                                sap.captureService("nodelivery");
                                Thread.Sleep(1000);
                            }
                            sap.CloseConnect();
                        }
                    }
                    catch (Exception ex)
                    {
                        SAP.errorLog(ex);
                    }
                    finally
                    {
                        System.Environment.Exit(0);
                    }
                    #endregion
                }

                if (conStr == "")
                {
                    conStr = System.Configuration.ConfigurationManager.AppSettings["SAPConnectionKey"].ToString();
                }
                if (conStr != "")
                {
                    #region SAP
                    SAP    sap = new SAP();
                    string ver = "(v1.00.91)";
                    sap.SboGuiApi = new SAPbouiCOM.SboGuiApi();

                    sap.SboGuiApi.Connect(conStr);
                    sap.SetApplication();
                    SAP.trace("Hana conStr = " + conStr);
                    if (conStr == "")
                    {
                        sap.showStatus("eBizCharge System Started. " + ver, SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                    }
                    else
                    {
                        sap.showStatus("eBizCharge System Started. " + ver + "  session id: " + conStr, SAPbouiCOM.BoMessageTime.bmt_Medium, false);
                    }
                    //SaveConfig(sap.dbName, sap.connStr);
                    sap.oSignalEvent.WaitOne();

                    #endregion
                }

                //mutex.ReleaseMutex();

                /*
                 * }
                 * else
                 * {
                 * //"only one instance at a time";
                 * }
                 */
            }
            catch (Exception ex)
            {
                SAP.errorLog(ex);
            }
        }
示例#8
0
        public void SaveAction()
        {
            bool bError = false;

            try
            {
                SAP oCompany = new SAP();

                oCompany.txtServer        = textDatabase.Text;
                oCompany.txtDBName        = txtCompanyDBName.Text;
                oCompany.txtDBPass        = textDBPassword.Text;
                oCompany.txtDBUser        = textDBUser.Text;
                oCompany.txtSBOPass       = txtSiteUserPassword.Text;
                oCompany.txtSBOUser       = txtSiteUser.Text;
                oCompany.txtLicenseServer = textLicense.Text;
                oCompany.txtMerchantID    = textSourceKey.Text;
                if (!oCompany.connect())
                {
                    MessageBox.Show(oCompany.lastError);
                    bError = true;
                    return;
                }
                try
                {
                    if (!Directory.Exists(@"C:\CBS\"))
                    {
                        Directory.CreateDirectory(@"C:\CBS\");
                    }
                    string filename = @"C:\CBS\eBizChargeForB1_Hana.XML";
                    try
                    {
                        if (File.Exists(filename))
                        {
                            File.Delete(filename);
                        }
                    }
                    catch (Exception) { }
                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml("<root/>");
                    XmlElement elem = doc.CreateElement("SAPLicenseServer");
                    elem.InnerText = textLicense.Text;
                    doc.DocumentElement.AppendChild(elem);
                    elem           = doc.CreateElement("SAPDBServer");
                    elem.InnerText = textDatabase.Text;
                    doc.DocumentElement.AppendChild(elem);
                    elem           = doc.CreateElement("SAPDBName");
                    elem.InnerText = txtCompanyDBName.Text;
                    doc.DocumentElement.AppendChild(elem);
                    doc.Save(filename);
                }catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }

                try
                {
                    MessageBox.Show("eBizCharge for Hana installation may take more then 30 sec to completed.  Please wait for process to complete");

                    oCompany.SAPSetup();
                }
                catch (Exception ex2)
                {
                    Program.errorLog(ex2.Message);
                }
                try
                {
                    B1InstallService.B1InstallServiceSoapClient install = new B1InstallService.B1InstallServiceSoapClient();
                    B1InstallService.SAPB1Install info = new B1InstallService.SAPB1Install();
                    info.AppPassWD = txtSiteUserPassword.Text;
                    info.AppUser   = txtSiteUser.Text;
                    info.DBName    = txtCompanyDBName.Text;
                    info.DBPassWD  = textDBPassword.Text;
                    info.DBServer  = textDatabase.Text;
                    info.DBUser    = textDBUser.Text;
                    info.Domain    = System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().DomainName;
                    if (info.Domain == "")
                    {
                        info.Domain = txtCompanyDBName.Text;
                    }

                    info.IP            = getIP();
                    info.LicenseServer = textLicense.Text;
                    info.PIN           = textPin.Text;
                    info.SourceKey     = textSourceKey.Text;
                    install.UpsertInfo(info);
                }
                catch (Exception) { }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                bError = true;
                Program.errorLog(ex);
            }
            finally
            {
                CopyFiles();
                this.pictureBox1.Visible = false;
                if (!bError)
                {
                    MessageBox.Show("Setup completed.  Please restart B1.");
                    this.Close();
                }
            }
        }
示例#9
0
        public IEnumerable <LootGeneratorItemInfo> GetIntrusionLootInfos(Outpost outpost, SAP sap)
        {
            var stability = outpost.GetIntrusionSiteInfo().Stability;
            var loots     = _intrusionLootInfos.Where(i => i.siteDefinition == outpost.Definition &&
                                                      i.sapDefinition == sap.Definition &&
                                                      i.stabilityThreshold.Min <= stability && i.stabilityThreshold.Max >= stability);

            foreach (var loot in loots)
            {
                var item = new ItemInfo(loot.itemDefinition, loot.quantity.Min, loot.quantity.Max); //roll random on init
                yield return(new LootGeneratorItemInfo(item, false, loot.probability));
            }
        }
示例#10
0
        public IActionResult GetDataJson(string block)
        {
            CustomerViewModel model = new CustomerViewModel();

            using (WebClient wc = new WebClient())
            {
                wc.Headers.Add(HttpRequestHeader.Cookie, "SAP_SESSIONID_LQU_047=neOFM3oWTtY6uOKMEBMygv-_PeGz6xHrvooAFj6rN8M%3d");
                string url          = "https://my352905.crm.ondemand.com/sap/c4c/odata/cust/v1/productdata_powerbi_api/MaterialCollection?$format=json&$filter=duAnIDName_SDK%20eq%20%27Q7%20BOULEVARD%27&fbclid=IwAR0Ci7FsAHHQKUQcZFZIGU65oMaOUVVuL-NfucAU99l-Iuls0wyZJ_xkHKk&sap-client=047&sap-language=EN";
                string jsonTokenKey = wc.DownloadString(url);
                try
                {
                    dynamic    JsontokenObj = JsonConvert.DeserializeObject(jsonTokenKey);
                    List <SAP> sAPs         = new List <SAP>();
                    for (int i = 0; i < JsontokenObj.d.results.Count; i++)
                    {
                        SAP sAP = new SAP();
                        sAP.ObjectID           = JsontokenObj.d.results[i].ObjectID.ToString();
                        sAP.ETag               = JsontokenObj.d.results[i].ETag.ToString();
                        sAP.RecordNumber       = JsontokenObj.d.results[i].RecordNumber.ToString();
                        sAP.ExternalKey        = JsontokenObj.d.results[i].ExternalKey.ToString();
                        sAP.Ngybngiaothct_KUT  = JsontokenObj.d.results[i].Ngybngiaothct_KUT.ToString();
                        sAP.duAnIDName_SDK     = JsontokenObj.d.results[i].duAnIDName_SDK.ToString();
                        sAP.khuBlockDuAn_SDK   = JsontokenObj.d.results[i].khuBlockDuAn_SDK.ToString();
                        sAP.FloorTngcSnphm_KUT = JsontokenObj.d.results[i].FloorTngcSnphm_KUT.ToString();
                        sAP.Description        = JsontokenObj.d.results[i].Description.ToString();

                        sAP.StatusTrngthiGiaodch_KUT = int.Parse(JsontokenObj.d.results[i].StatusTrngthiGiaodch_KUT.ToString());
                        sAP.LocationVtr_KUT          = int.Parse(JsontokenObj.d.results[i].LocationVtr_KUT.ToString());
                        var stringFoll = JsontokenObj.d.results[i].FloorTnghm_KUT.ToString().Replace("Tầng ", "").Split("+");
                        sAP.FloorTnghm_KUT = int.Parse(stringFoll[stringFoll.Length - 1]);
                        sAP.FloorMar       = stringFoll.Length;
                        sAP.ListFloor      = new List <int>();
                        for (int j = 0; j < stringFoll.Length; j++)
                        {
                            int fl = int.Parse(stringFoll[j]);
                            sAP.ListFloor.Add(fl);
                        }
                        sAPs.Add(sAP);
                    }
                    List <SAP> sAPBLOCK    = sAPs.Where(x => x.khuBlockDuAn_SDK.Equals(block)).ToList();
                    int        max         = sAPBLOCK.OrderByDescending(x => x.FloorTnghm_KUT).First().FloorTnghm_KUT;
                    int        maxLocation = sAPBLOCK.OrderByDescending(x => x.LocationVtr_KUT).First().LocationVtr_KUT;
                    int        minLocation = sAPBLOCK.OrderBy(x => x.LocationVtr_KUT).First().LocationVtr_KUT;

                    model.MaxLocation = maxLocation;
                    model.MinLocation = minLocation;
                    model.saps        = sAPBLOCK;
                    model.dataTables  = new List <DataTable>();
                    for (int i = max; i >= 0; i--)
                    {
                        DataTable dataTable = new DataTable();
                        dataTable.Floor      = i;
                        dataTable.dataHouses = new List <DataHouse>();
                        for (int j = minLocation; j <= maxLocation; j++)
                        {
                            DataHouse dataHouse = new DataHouse();
                            SAP       mSap      = sAPBLOCK.Where(x => x.FloorTnghm_KUT == i && x.LocationVtr_KUT == j).FirstOrDefault();
                            if (mSap != null)
                            {
                                dataHouse.Detail   = mSap.Description;
                                dataHouse.Status   = "status_" + mSap.StatusTrngthiGiaodch_KUT;
                                dataHouse.MarFloor = mSap.FloorMar;
                                dataHouse.IsMer    = false;
                            }
                            else
                            {
                                List <SAP> mSaps = sAPBLOCK.Where(x => x.ListFloor.Contains(i) && x.LocationVtr_KUT == j).ToList();
                                if (mSaps.Count > 0)
                                {
                                    dataHouse.IsMer = true;
                                }
                                else
                                {
                                    dataHouse.IsMer = false;
                                }
                                dataHouse.Detail   = "";
                                dataHouse.Status   = "status_";
                                dataHouse.MarFloor = 1;
                            }
                            dataTable.dataHouses.Add(dataHouse);
                        }
                        model.dataTables.Add(dataTable);

                        model.Name = "SO DO BLOCK " + block + " DU AN " + " " + sAPBLOCK[0].duAnIDName_SDK;
                    }

                    model.statusDatas = new List <StatusData>();

                    StatusData statusData101 = new StatusData();
                    statusData101.Name       = "Giữ chỗ";
                    statusData101.nameClass  = "status_101";
                    statusData101.StatusCode = 101;
                    model.statusDatas.Add(statusData101);
                    StatusData statusData111 = new StatusData();
                    statusData111.Name       = "Đặt cọc";
                    statusData111.nameClass  = "status_111";
                    statusData111.StatusCode = 111;
                    model.statusDatas.Add(statusData111);

                    StatusData statusData121 = new StatusData();
                    statusData121.Name       = "Góp, vay vốn";
                    statusData121.nameClass  = "status_121";
                    statusData121.StatusCode = 121;
                    model.statusDatas.Add(statusData121);

                    StatusData statusData131 = new StatusData();
                    statusData131.Name       = "Mua bán";
                    statusData131.nameClass  = "status_131";
                    statusData131.StatusCode = 131;
                    model.statusDatas.Add(statusData131);

                    StatusData statusData141 = new StatusData();
                    statusData141.Name       = "Mở bán";
                    statusData141.nameClass  = "status_141";
                    statusData141.StatusCode = 141;
                    model.statusDatas.Add(statusData141);

                    StatusData statusData151 = new StatusData();
                    statusData151.Name       = "Bàn giao GCN";
                    statusData151.nameClass  = "status_151";
                    statusData151.StatusCode = 151;
                    model.statusDatas.Add(statusData151);

                    StatusData statusData161 = new StatusData();
                    statusData161.Name       = "Bàn giao sản phẩm";
                    statusData161.nameClass  = "status_161";
                    statusData161.StatusCode = 161;
                    model.statusDatas.Add(statusData161);


                    StatusData statusData171 = new StatusData();
                    statusData171.Name       = "Đã xây dựng nhà";
                    statusData171.nameClass  = "status_171";
                    statusData171.StatusCode = 171;
                    model.statusDatas.Add(statusData171);

                    StatusData statusData181 = new StatusData();
                    statusData181.Name       = "Đã yêu cần thanh lý";
                    statusData181.nameClass  = "status_181";
                    statusData181.StatusCode = 181;
                    model.statusDatas.Add(statusData181);

                    StatusData statusData191 = new StatusData();
                    statusData191.Name       = "Đã yêu cần chuyển nhượng";
                    statusData191.nameClass  = "status_191";
                    statusData191.StatusCode = 191;
                    model.statusDatas.Add(statusData191);

                    StatusData statusData201 = new StatusData();
                    statusData201.Name       = "Xả bán";
                    statusData201.nameClass  = "status_201";
                    statusData201.StatusCode = 201;
                    model.statusDatas.Add(statusData201);


                    for (int i = 0; i < model.statusDatas.Count; i++)
                    {
                        model.statusDatas[i].Value = model.saps.Where(x => x.StatusTrngthiGiaodch_KUT == model.statusDatas[i].StatusCode).Count();
                    }
                }
                catch
                {
                }
            }
            return(View(model));
        }