Beispiel #1
0
    private int NameMaxNum(nameType type)
    {
        int num = 0;

        switch (type)
        {
        case nameType.FIRSTNAME:
            foreach (DictionaryEntry tr in TableManager.GetRandomname())
            {
                Tab_Randomname tbr = tr.Value as Tab_Randomname;
                if (tbr.Type == 0)
                {
                    num++;
                }
            }
            break;

        case nameType.LASTNAME:
            foreach (DictionaryEntry tr in TableManager.GetRandomname())
            {
                Tab_Randomname tbr = tr.Value as Tab_Randomname;
                if (tbr.Type == 1)
                {
                    num++;
                }
            }
            break;

        default:
            num = 0;
            break;
        }
        return(num);
    }
Beispiel #2
0
    // Use this for initialization
    void Start()
    {
        Array values = Enum.GetValues(typeof(nameType));

        System.Random random = new System.Random();
        pickUpName = (nameType)values.GetValue(random.Next(values.Length));
        while (otherPowerUp1.GetComponent <PickUpScript>().pickUpName == this.pickUpName || otherPowerUp2.GetComponent <PickUpScript>().pickUpName == this.pickUpName)
        {
            pickUpName = (nameType)values.GetValue(random.Next(values.Length));
        }
        setSprite();
    }
        public static bool WriteXmlFileUsingDataTable(DataTable _dtTandetails, string _tannumber, string outxmlfile)
        {
            bool blStatus = false;

            try
            {
                if (_dtTandetails != null)
                {
                    if (_dtTandetails.Rows.Count > 0)
                    {
                        patentInfo patentInfo_Obj = new patentInfo();
                        patentInfo_Obj.tan      = _tannumber;
                        patentInfo_Obj.language = languageType.en;

                        int intMolCnt = _dtTandetails.Rows.Count;

                        patentLocation patLoc    = null;
                        name[]         name_Arr  = null;
                        name           name_obj  = null;
                        names          names_Arr = null;
                        nameType       namType   = null;

                        structureDataType structDtype = null;

                        string[] strIUpacName = null;

                        propheticSubstance   propSubstance_Obj  = null;
                        propheticSubstance[] propSubstance_Arr  = new propheticSubstance[intMolCnt];
                        propheticSubstances  propSubstances_Obj = null;

                        patent patent_Obj = new patent();

                        int    intCntr  = 0;
                        string strMol   = "";
                        byte[] barr_Mol = null;
                        int    v3000    = 0;
                        double nullMol  = 0.0;

                        MolHandler objMHandler = null;

                        for (int i = 0; i < _dtTandetails.Rows.Count; i++)
                        {
                            objMHandler = new MolHandler(_dtTandetails.Rows[i]["structure"].ToString());

                            v3000 = 0;
                            v3000 = objMHandler.toFormat("mol").IndexOf("V3000");

                            nullMol = 0.0;
                            nullMol = objMHandler.calcMolWeight();

                            barr_Mol = null;
                            if (v3000 == -1 && nullMol != 0)
                            {
                                patLoc              = new patentLocation();
                                patLoc.pageLabel    = _dtTandetails.Rows[i]["page_label"].ToString();
                                patLoc.pageNumber   = _dtTandetails.Rows[i]["page_number"].ToString();
                                patLoc.exampleLabel = _dtTandetails.Rows[i]["example_number"].ToString();

                                name_obj      = new name();
                                name_obj.lang = languageType.en;

                                string[] strArr_EnName = new string[1];
                                strArr_EnName[0] = _dtTandetails.Rows[i]["en_name"].ToString();
                                name_obj.Text    = strArr_EnName;

                                name_Arr    = new name[1];
                                name_Arr[0] = name_obj;

                                strIUpacName    = new string[1];
                                strIUpacName[0] = _dtTandetails.Rows[i]["iupac_name"].ToString();

                                namType      = new nameType();
                                namType.Text = strIUpacName;

                                names_Arr           = new names();
                                names_Arr.IUPACName = namType;
                                names_Arr.name      = name_Arr;

                                strMol   = _dtTandetails.Rows[i]["structure"].ToString();
                                barr_Mol = null;
                                barr_Mol = System.Text.ASCIIEncoding.ASCII.GetBytes(strMol);

                                structDtype       = new structureDataType();
                                structDtype.Value = barr_Mol;

                                propSubstance_Obj = new propheticSubstance();
                                propSubstance_Obj.structureData  = structDtype;
                                propSubstance_Obj.patentLocation = patLoc;
                                propSubstance_Obj.names          = names_Arr;

                                propSubstance_Arr[intCntr] = propSubstance_Obj;
                                intCntr++;
                            }
                        }

                        propSubstances_Obj = new propheticSubstances();
                        propSubstances_Obj.propheticSubstance = propSubstance_Arr;

                        patent_Obj.patentInfo          = patentInfo_Obj;
                        patent_Obj.propheticSubstances = propSubstances_Obj;

                        // Serialization
                        XmlSerializer xmlSer    = new XmlSerializer(typeof(patent));
                        TextWriter    txtWriter = new StreamWriter(outxmlfile);
                        xmlSer.Serialize(txtWriter, patent_Obj);

                        txtWriter.Close();
                        txtWriter.Dispose();

                        blStatus = true;
                        return(blStatus);
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandling_NTS.WriteErrorLog(ex.ToString());
            }
            return(blStatus);
        }
        public static bool WriteXmlFileUsingXSD(string infilename, string tannumber, string outputfilepath)
        {
            bool blStatus = false;

            try
            {
                patentInfo patentInfo_Obj = new patentInfo();
                patentInfo_Obj.tan      = tannumber;
                patentInfo_Obj.language = languageType.en;

                //Specify input file to MolInputStream object
                MolInputStream molInStream = new MolInputStream(new FileInputStream(infilename));
                MolImporter    molImp      = new MolImporter(molInStream);
                Molecule       mol         = new Molecule();

                //int intMolCnt = molImp.getRecordCount();
                int intMolCnt = ChemistryOperations.GetMoleculeCountFromFile(infilename);

                patentLocation patLoc    = null;
                name[]         name_Arr  = null;
                name           name_obj  = null;
                names          names_Arr = null;
                nameType       namType   = null;

                structureDataType structDtype = null;

                string[] strIUpacName = null;

                propheticSubstance   propSubstance_Obj  = null;
                propheticSubstance[] propSubstance_Arr  = new propheticSubstance[intMolCnt];
                propheticSubstances  propSubstances_Obj = null;

                patent patent_Obj = new patent();

                int intCntr = 0;

                //Read molecules from molImporter
                while (molImp.read(mol))
                {
                    patLoc              = new patentLocation();
                    patLoc.pageLabel    = mol.getProperty("Page Label");
                    patLoc.pageNumber   = mol.getProperty("Page Number");
                    patLoc.exampleLabel = mol.getProperty("Example Number");

                    name_Arr = new name[1];

                    name_obj      = new name();
                    name_obj.lang = languageType.en;

                    string[] strArr_EnName = new string[1];
                    strArr_EnName[0] = mol.getProperty("en name").Trim();
                    name_obj.Text    = strArr_EnName;

                    name_Arr[0] = name_obj;

                    strIUpacName    = new string[1];
                    strIUpacName[0] = mol.getProperty("IUPAC Name").Trim();

                    namType      = new nameType();
                    namType.Text = strIUpacName;

                    names_Arr           = new names();
                    names_Arr.IUPACName = namType;
                    names_Arr.name      = name_Arr;

                    string strMol = mol.toFormat("mol");

                    int    v3000   = strMol.IndexOf("V3000");
                    double nullMol = mol.getExactMass();

                    byte[] barr_Mol = null;

                    if (v3000 == -1 && nullMol != 0)
                    {
                        barr_Mol = System.Text.ASCIIEncoding.ASCII.GetBytes(strMol);
                    }

                    structDtype       = new structureDataType();
                    structDtype.Value = barr_Mol;

                    propSubstance_Obj = new propheticSubstance();
                    propSubstance_Obj.structureData  = structDtype;
                    propSubstance_Obj.patentLocation = patLoc;
                    propSubstance_Obj.names          = names_Arr;

                    propSubstance_Arr[intCntr] = propSubstance_Obj;
                    intCntr++;
                }

                propSubstances_Obj = new propheticSubstances();
                propSubstances_Obj.propheticSubstance = propSubstance_Arr;

                patent_Obj.patentInfo          = patentInfo_Obj;
                patent_Obj.propheticSubstances = propSubstances_Obj;

                // Serialization
                XmlSerializer xmlSer    = new XmlSerializer(typeof(patent));
                TextWriter    txtWriter = new StreamWriter(outputfilepath);
                xmlSer.Serialize(txtWriter, patent_Obj);

                txtWriter.Close();
                txtWriter.Dispose();

                molInStream.close();
                molImp.close();

                blStatus = true;
                return(blStatus);
            }
            catch (Exception ex)
            {
                ErrorHandling_NTS.WriteErrorLog(ex.ToString());
            }
            return(blStatus);
        }
Beispiel #5
0
        public HttpResponseMessage TransferBal(string beneficiaryAccountNo, string beneficiaryIFSC, string beneficiaryMMID, string beneficiaryMobileNo, string Name, string address1,
                                               string emailID, string mobileNo, string uniqueRequestNo, string appID, string customerID, string debitAccountNo, float transferAmount)
        {
            DataSet ds  = new DataSet();
            string  URL = "Transfer/TransferBal&beneficiaryAccountNo?" + beneficiaryAccountNo + "&beneficiaryIFSC?" + beneficiaryIFSC + "&beneficiaryMMID?" + beneficiaryMMID + "&beneficiaryMobileNo?" + beneficiaryMobileNo + "&Name?" + Name + "&address1?" + address1 + "&emailID?" + emailID + "&mobileNo?" + mobileNo + "&uniqueRequestNo?" + uniqueRequestNo + "&appID?" + appID + "&customerID?" + customerID + "&debitAccountNo?" + debitAccountNo + "&transferAmount?" + transferAmount + "";

            ds = c.getInserlogrequest(URL);
            APIBanking.Environment env = new APIBanking.Environments.YBL.UAT("2449810", "Yesbank1", "7a7a26d8-1679-436b-854a-a2b5682bbf11", "nP8oE0tO5wR5kI1qD3aA6aR6wD6hR7hB8oP6qW5vU0hN0wE4sD", null);
            // APIBanking.Environment env = new APIBanking.Environments.YBL.UAT(ConfigurationManager.AppSettings["customerId"].ToString(), ConfigurationManager.AppSettings["Password"].ToString(), ConfigurationManager.AppSettings["clientId"].ToString(), ConfigurationManager.AppSettings["clientSecret"].ToString(), ConfigurationManager.AppSettings["CertificatePath"].ToString(), "123");
            com.transfer         gTransfer         = new transfer();
            com.transferRequest  gTransferRequest  = new transferRequest();
            com.transferResponse gTransferResponse = new transferResponse();



            beneficiaryDetailType b = new beneficiaryDetailType();

            b.beneficiaryAccountNo = beneficiaryAccountNo;
            b.beneficiaryIFSC      = beneficiaryIFSC;
            b.beneficiaryMMID      = beneficiaryMMID;
            b.beneficiaryMobileNo  = beneficiaryMobileNo;

            beneficiaryType bt = new beneficiaryType();
            nameType        nm = new nameType();

            nm.Item = Name;

            AddressType ad = new AddressType();

            ad.address1 = address1;
            //ad.address2 = "";
            // ad.address3 = "";
            // ad.city = "";
            ad.country = "IN";
            //ad.postalCode = "";

            contactType ct = new contactType();

            ct.emailID  = emailID;
            ct.mobileNo = mobileNo;

            b.beneficiaryName    = nm;
            b.beneficiaryAddress = ad;
            b.beneficiaryContact = ct;

            gTransfer.beneficiary      = bt;
            gTransfer.beneficiary.Item = b;
            gTransfer.version          = "2";
            gTransfer.uniqueRequestNo  = uniqueRequestNo; //Ihno
            gTransfer.appID            = appID;
            gTransfer.customerID       = customerID;
            gTransfer.debitAccountNo   = debitAccountNo;
            gTransfer.transferAmount   = transferAmount;
            //gTransfer.transferType = transferTypeType.IMPS;
            gTransfer.transferType              = transferTypeType.IMPS;
            gTransfer.transferCurrencyCode      = currencyCodeType.INR;
            gTransfer.remitterToBeneficiaryInfo = "FUND TRANSFER";
            try
            {
                gTransferResponse = APIBanking.DomesticRemittanceClient.getTransfer(env, gTransfer);
                //return Request.CreateResponse(HttpStatusCode.OK, getBalanceResponse);
                StringWriter  sw         = new StringWriter();
                XmlTextWriter tw         = null;
                XmlSerializer serializer = new XmlSerializer(gTransferResponse.GetType());
                tw = new XmlTextWriter(sw);
                serializer.Serialize(tw, gTransferResponse);
                string tes = sw.ToString();
                c.updatelogrequest(Convert.ToInt32(ds.Tables[0].Rows[0]["KMR_Slno"]), tes.ToString());
                c.InsertResponse(gTransferResponse.transactionStatus.subStatusCode, gTransferResponse.transactionStatus.statusCode.ToString(), gTransferResponse.requestReferenceNo, gTransferResponse.transactionStatus.bankReferenceNo);
                return(this.Request.CreateResponse(HttpStatusCode.OK, gTransferResponse));
            }
            catch (FaultException ex)
            {
                String faultCode   = ex.Code.SubCode.Name;
                String FaultReason = ex.Message;
                message = faultCode + " - " + FaultReason;
                HttpError myCustomError = new HttpError();
                myCustomError.Add("ErrorCode", faultCode);
                myCustomError.Add("Errormsg", FaultReason);
                myCustomError.Add("Ihno", uniqueRequestNo);
                StringWriter  sw         = new StringWriter();
                XmlTextWriter tw         = null;
                XmlSerializer serializer = new XmlSerializer(myCustomError.GetType());
                tw = new XmlTextWriter(sw);
                serializer.Serialize(tw, myCustomError);
                string tes = sw.ToString();
                c.updatelogrequest(Convert.ToInt32(ds.Tables[0].Rows[0]["KMR_Slno"]), tes);
                c.InsertResponse(faultCode, FaultReason, uniqueRequestNo, "");
                c.writelog(ex.Message, "FaultException", DateTime.Now, "", "");
                return(Request.CreateResponse(HttpStatusCode.ExpectationFailed, myCustomError));
            }
            //catch (TimeoutException ex)
            //{
            //    message = ex.Message;
            //    HttpError myCustomError = new HttpError(message);
            //   // return Request.CreateErrorResponse(HttpStatusCode.BadRequest, myCustomError);
            //    //return this.Request.CreateResponse(HttpStatusCode.OK, gTransferResponse);
            //}
            //catch (CommunicationException ex)
            //{
            //    message = ex.Message;
            //    HttpError myCustomError = new HttpError(message);
            //   // return Request.CreateErrorResponse(HttpStatusCode.BadRequest, myCustomError);
            //    //return this.Request.CreateResponse(HttpStatusCode.OK, gTransferResponse);
            //}
            catch (Exception ex)
            {
                c.writelog(ex.Message, "TransferBal", DateTime.Now, "", "");
                HttpError myCustomError = new HttpError();
                myCustomError.Add("ErrorCode", 500);
                myCustomError.Add("Errormsg", "InternerlServer Error");
                myCustomError.Add("Ihno", uniqueRequestNo);
                StringWriter  sw         = new StringWriter();
                XmlTextWriter tw         = null;
                XmlSerializer serializer = new XmlSerializer(myCustomError.GetType());
                tw = new XmlTextWriter(sw);
                serializer.Serialize(tw, myCustomError);
                string tes = sw.ToString();
                c.updatelogrequest(Convert.ToInt32(ds.Tables[0].Rows[0]["KMR_Slno"]), tes);
                c.InsertResponse("500", ex.Message, uniqueRequestNo, "");
                c.writelog(ex.Message, "TransferBal", DateTime.Now, "", "");
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, myCustomError));
            }
        }
Beispiel #6
0
        private void WriteXMLUsingXSD()
        {
            try
            {
                patentInfo pinfo = new patentInfo();
                pinfo.tan      = "12345678D";
                pinfo.language = languageType.en;

                patentLocation ploc = new patentLocation();
                ploc.pageLabel    = "00";
                ploc.pageNumber   = "5";
                ploc.exampleLabel = "00";

                name[] nm = new name[1];

                name nm1 = new name();
                nm1.lang = languageType.en;

                nm[0] = nm1;

                string[] strIUpacName = { "Benzene" };

                nameType nType = new nameType();
                nType.Text = strIUpacName;

                names nms = new names();
                nms.IUPACName = nType;
                nms.name      = nm;

                string strMol = @"OS0oMy1BY2V0eWwtNC1mbHVvcm9waGVueWwpLTYtY2hsb3JvcHVyaW5lCiAgTWFydmluICAwNDI0MTAxNzA5Mk";
                byte[] br     = System.Text.ASCIIEncoding.ASCII.GetBytes(strMol);

                structureDataType sDtype = new structureDataType();
                sDtype.type     = structureDataTypeType.MDLMolfileV2000;
                sDtype.encoding = structureDataTypeEncoding.Base64;
                sDtype.Value    = br;

                propheticSubstance ps11 = new propheticSubstance();
                ps11.structureData  = sDtype;
                ps11.structureData  = sDtype;
                ps11.patentLocation = ploc;
                ps11.names          = nms;

                propheticSubstance[] ps1 = new propheticSubstance[1];
                ps1[0] = ps11;

                propheticSubstances ps = new propheticSubstances();
                ps.propheticSubstance = ps1;

                patent pr = new patent();
                pr.patentInfo          = pinfo;
                pr.propheticSubstances = ps;


                // Serialization
                XmlSerializer s = new XmlSerializer(typeof(patent));
                TextWriter    w = new StreamWriter(@"c:\list12345.xml");
                s.Serialize(w, pr);
                w.Close();
            }
            catch (Exception ex)
            {
                PepsiLiteErrorHandling.WriteErrorLog(ex.ToString());
            }
        }
Beispiel #7
0
 public string generateName(nameType typeOfName)
 {
     return(typeOfName.ToString() + rng.Next(99, 999).ToString());
 }