Esempio n. 1
0
        public bool delete_log()
        {
            String Record = new string(' ', 200);

            //oCustomer.dsReadFld(cust_channel,cust_sKey,0,"id,flag,company_id",ref arrCustomers);
            arrCustomers.SetValue("3", 1);

            oCustomer.dsExtractRec(cust_channel, cust_sKey, 0, ref Record);
            //oCustomer.dsExtractFld(cust_channel,cust_sKey,0,"id,flag,company_id",ref arrCustomers);

            /*int Update = oCustomer.dsWriteFld(cust_channel,cust_sKey,Record,"id,flag,company_id",ref arrCustomers);
             * if (Update==13)
             *  MessageBox.Show("It couldn't update the file (log)");
             */
            int err = oCustomer.dsRemoveRec(cust_channel, cust_sKey);

            if (err != -1)
            {
                MessageBox.Show(err.ToString());
                return(false);
            }
            else
            {
                return(true);
            }
        }
Esempio n. 2
0
        public bool write_header_order()
        {
            int    err    = 0;
            String Record = new string(' ', 200);

            System.Array arrDetail = new System.String[13];

            oCustomer.dsTmpl(channel, "teacher:c(30),student:c(30*),type:c(3*),prize:c(10*),no_items:n(10*),retail:n(10*),collected:n(10*),tax:n(10*),printed:n(1*),disc_printed:n(1*),box:c(10*),entry_date:n(10*):date=jul:,phone:c(10)");            //final field ascterisc relevant

            this.Header.CustomerID = this.sCustomerID;
            this.Header.CompanyID  = this.sCompanyID;

            arrDetail.SetValue(this.Header.Teacher.PadRight(30, ' '), 0);
            arrDetail.SetValue(this.Header.Student.PadRight(30, ' '), 1);
            arrDetail.SetValue(this.Header.Type, 2);
            arrDetail.SetValue(this.Header.Prize, 3);
            arrDetail.SetValue(this.Header.No_Items, 4);
            arrDetail.SetValue(this.Header.Retail, 5);
            arrDetail.SetValue(this.Header.Collected, 6);
            arrDetail.SetValue(this.Header.Tax, 7);
            arrDetail.SetValue(this.Header.Printed, 8);
            arrDetail.SetValue(this.Header.Disc_Printed, 9);
            arrDetail.SetValue(this.Header.Box, 10);
            arrDetail.SetValue(this.Header.Date, 11);
            arrDetail.SetValue(this.Header.Phone, 12);

            this.sKey = arrDetail.GetValue(0).ToString() + arrDetail.GetValue(1).ToString() + "000";
            err       = oCustomer.dsExtractRec(this.channel, this.sKey, 0, ref Record);
            if (err != -1)
            {
                if (err == 11)
                {
                    Record = "";
                }
                else
                {
                    MessageBox.Show(err.ToString());
                    return(false);
                }
            }

            err = oCustomer.dsWriteFld(this.channel, this.sKey, Record, "teacher,student,type,prize,no_items,retail,collected,tax,printed,disc_printed,box,entry_date,phone", ref arrDetail);
            if (err != -1)
            {
                MessageBox.Show("err=" + err.ToString() + "  Lenght: " + Record.Length.ToString());
                return(false);
            }
            return(true);
        }
Esempio n. 3
0
        public bool Write(String Key, String sFields, String sValues)
        {
            String Record = new string(' ', 1000);

            String[]     Fields    = sFields.Split(',');
            String[]     Values    = sValues.Split('|');
            System.Array arrValues = new System.String[Fields.GetLength(0) + 1];


            this.sKey = Key;


            int i = 0;

            foreach (String f in Fields)
            {
                arrValues.SetValue(Values.GetValue(i).ToString(), i);
                i++;
            }



            err = oFile.dsExtractRec(this.channel, this.sKey, 0, ref Record);
            if (err != -1)
            {
                if (err == 11)
                {
                    Record = "";
                }
                else
                {
                    this.Error = err.ToString();
                    return(false);
                }
            }

            err = oFile.dsWriteFld(this.channel, this.sKey, Record, sFields, ref arrValues);
            if (err != -1)
            {
                this.Error = "err=" + err.ToString() + "  Lenght: " + Record.Length.ToString();
                return(false);
            }

            return(true);
        }