コード例 #1
0
        private void lvwOutbox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lvwOutbox.SelectedIndices.Count == 1)
            {
                ShuratHaklada shurat_haklada = (ShuratHaklada)lvwOutbox.Items[lvwOutbox.SelectedIndices[0]].Tag;

                SetComboItemByValue(companyIDComboBox, shurat_haklada.CompanyID);
                //companyIDComboBox.SelectedValue = shurat_haklada.CompanyID;
                SugTnua sug_tnua = ActionsListDictionary[shurat_haklada.ActionCode];
                //SetComboItemByValue2(cmbActionType, shurat_haklada.ActionCode);
                SetComboItemByText2(cmbActionType, sug_tnua.ActionTypeIN);
                //cmbActionType.Text = sug_tnua.ActionTypeOUT;// shurat_haklada.ActionCode;
                txtActionDetails.Text     = shurat_haklada.ActionDetails;
                txtMisparMismach.Text     = shurat_haklada.MisparMismach.ToString();
                dtpTarichMismachNew.Value = shurat_haklada.TarichMismach;
                dtpTarichAcherNew.Value   = shurat_haklada.TarichAcher;
                txtMaam.Text            = shurat_haklada.AhuzHaMaam.ToString();
                txtSchumPaturMmam.Text  = shurat_haklada.SchumPaturMaam.ToString();
                txtSchumHaMaam.Text     = shurat_haklada.SchumMaam.ToString();
                txtSchumKolelMaam.Text  = shurat_haklada.SchumKolelMaam.ToString();
                attachmnentTextBox.Text = shurat_haklada.Attachment;
                //shurat_haklada.CompamyInfoCountryID = Convert.ToInt32(CountryID);
                //shurat_haklada.CompamyInfoVAT = CompanyVAT;
            }

            btnUpdate.Enabled     = (lvwOutbox.SelectedIndices.Count == 1);
            btnDelete.Enabled     = btnUpdate.Enabled;
            btnTochenTnua.Enabled = btnUpdate.Enabled;
        }
コード例 #2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (ValidateForm())
            {
                ShuratHaklada shurat_haklada = CreateShuratHaklada();

                shurat_haklada.TransactionGUID = ((ShuratHaklada)lvwOutbox.Items[lvwOutbox.SelectedIndices[0]].Tag).TransactionGUID;
                dblayer.UpdateShuratHaklada(shurat_haklada);
                dblayer.ReadShuratHakladaList(lvwOutbox, Company_Info.CompanyCountryID.ToString(), Company_Info.CompanyVAT, ActionsListDictionary);
                CleanForm();
            }
        }
コード例 #3
0
 private void EditTochenTnua()
 {
     if (lvwOutbox.SelectedIndices.Count == 1)
     {
         ShuratHaklada        shurat_haklada = (ShuratHaklada)lvwOutbox.Items[lvwOutbox.SelectedIndices[0]].Tag;
         frmHakladaTochenTnua frm            = new frmHakladaTochenTnua();
         frm.Company_Info    = Company_Info;
         frm.dblayer         = dblayer;
         frm.parser          = parser;
         frm.TransactionGUID = shurat_haklada.TransactionGUID;
         frm.ShowDialog();
     }
 }
コード例 #4
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     btnDelete.Enabled = false;
     if (lvwOutbox.SelectedIndices.Count == 1)
     {
         if (MessageBox.Show("Delete Record ", "Delete Record", MessageBoxButtons.YesNo, MessageBoxIcon.Stop, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
         {
             ShuratHaklada shurat_haklada = (ShuratHaklada)lvwOutbox.Items[lvwOutbox.SelectedIndices[0]].Tag;
             dblayer.DeleteOutboxHaklada(shurat_haklada.TransactionGUID);
             dblayer.ReadShuratHakladaList(lvwOutbox, Company_Info.CompanyCountryID.ToString(), Company_Info.CompanyVAT, ActionsListDictionary);
         }
     }
     btnDelete.Enabled = true;
 }
コード例 #5
0
        private ShuratHaklada CreateShuratHakladaHavshavshevet(string line)
        {
            ShuratHaklada shurat_haklada = new ShuratHaklada();
            int           pos            = 0;
            String        CountryID      = Convert.ToInt32(line.Substring(pos, 4)).ToString();

            pos += 4;
            String CompanyVAT = line.Substring(pos, 9);

            pos += 9;
            String CompanyName = line.Substring(pos, 30);

            pos += 30;

            Company company = CompanyIdentification.Identify(dblayer, Company_Info, CountryID, CompanyVAT, CompanyName, null);

            if (company != null)
            {
                shurat_haklada.CompanyID = dblayer.GetCompany(CountryID, CompanyVAT).CompanyID;

                shurat_haklada.ActionCode = Convert.ToInt32(line.Substring(pos, 2));
                pos += 2;
                shurat_haklada.MisparMismach = Convert.ToInt32(line.Substring(pos, 9));
                pos += 9;
                shurat_haklada.TarichMismach = Convert.ToDateTime(line.Substring(pos, 10));
                pos += 10;
                shurat_haklada.TarichAcher = Convert.ToDateTime(line.Substring(pos, 10));
                pos += 10;
                shurat_haklada.ActionDetails = line.Substring(pos, 70);
                pos += 70;
                shurat_haklada.AhuzHaMaam = Convert.ToDouble(line.Substring(pos, 5));
                pos += 5;
                shurat_haklada.SchumPaturMaam = Convert.ToDouble(line.Substring(pos, 12));
                pos += 12;
                shurat_haklada.SchumMaam = Convert.ToDouble(line.Substring(pos, 12));
                pos += 12;
                shurat_haklada.SchumKolelMaam = Convert.ToDouble(line.Substring(pos, 12));
                pos += 12;
                shurat_haklada.Attachment = line.Substring(pos, line.Length - pos);

                shurat_haklada.CompamyInfoCountryID = Company_Info.CompanyCountryID;
                shurat_haklada.CompamyInfoVAT       = Company_Info.CompanyVAT;
            }

            return(shurat_haklada);
        }
コード例 #6
0
        ////////////////////////////////////////////////////////////////////////////////////////////

        private ShuratHaklada CreateShuratHakladaMokupINI(string line, string delimiter)
        {
            PrepareIniFileName();

            ShuratHaklada shurat_haklada = new ShuratHaklada();

            string[] parts = line.Split(new string[] { delimiter }, StringSplitOptions.None);

            String CompanyVAT  = GetOutboxImportStringValue("VAT", parts).ToString();
            String CompanyName = GetOutboxImportStringValue("CompanyName", parts);

            Company company = CompanyIdentification.Identify(dblayer, Company_Info, null, CompanyVAT, CompanyName, null);

            if (company != null)
            {
                CompanyVAT  = company.CompanyVAT;
                CompanyName = company.CompanyName;

                shurat_haklada.CompanyID      = company.CompanyID;
                shurat_haklada.CountryID      = GetOutboxImportIntValue("CountryID", parts);
                shurat_haklada.CompanyVAT     = CompanyVAT;  // iniFile.IniReadValue(companyinfo.CompanySerialNumber + " Import Outbox Structure", "VAT");
                shurat_haklada.CompanyName    = CompanyName; // iniFile.IniReadValue(companyinfo.CompanySerialNumber + " Import Outbox Structure", "CountryName");
                shurat_haklada.ActionCode     = GetOutboxImportIntValue("ActionCode", parts);
                shurat_haklada.MisparMismach  = GetOutboxImportIntValue("MisparMismach", parts);
                shurat_haklada.TarichMismach  = GetOutboxImportDateTimeValue("TarichMismach", parts);
                shurat_haklada.TarichAcher    = GetOutboxImportDateTimeValue("TarichAcher", parts);
                shurat_haklada.ActionDetails  = GetOutboxImportStringValue("ActionDetails", parts);
                shurat_haklada.AhuzHaMaam     = GetOutboxImportDoubleValue("Maam", parts);
                shurat_haklada.SchumPaturMaam = GetOutboxImportIntValue("SchumPaturMaam", parts);
                shurat_haklada.SchumMaam      = GetOutboxImportIntValue("SchumMaam", parts);
                shurat_haklada.SchumKolelMaam = GetOutboxImportIntValue("SchumKolelMaam", parts);
                shurat_haklada.Attachment     = GetOutboxImportStringValue("Attachment", parts);

                shurat_haklada.CompamyInfoCountryID = Company_Info.CompanyCountryID;
                shurat_haklada.CompamyInfoVAT       = Company_Info.CompanyVAT;
            }

            return(shurat_haklada);
        }
コード例 #7
0
        public void ImportHakladaMokupINI(String filename, CompanyInfo _companyinfo, DBLayer _dblayer, string delimiter)
        {
            Company_Info = _companyinfo;
            dblayer      = _dblayer;

            String       line = "";
            StreamReader sr   = new StreamReader(filename, CurrentImportEncoding); //Encoding.GetEncoding("iso-8859-8") //Hebrew From Magic

            while (!sr.EndOfStream)
            {
                line = sr.ReadLine();
                dblayer.Current_Company_Info = _companyinfo;
                //dblayer.AddCompany(CreateCompanyDelimter(line, delimiter));
                ShuratHaklada shurat_haklada = CreateShuratHakladaMokupINI(line, delimiter);

                if (shurat_haklada.Attachment == "")
                {
                    if (Company_Info.FilesSearch != null)
                    {
                        try
                        {
                            string[] files = Directory.GetFiles(Company_Info.FilesSearch, "*" + shurat_haklada.MisparMismach + "*.*");
                            if (files.Length == 1)
                            {
                                shurat_haklada.Attachment = files[0].ToString();
                            }
                        }
                        catch (Exception)
                        {
                        }
                    }
                }

                String TransactionGUID = dblayer.AddHakladaRecord(shurat_haklada);
            }

            sr.Close();
        }
コード例 #8
0
        private ShuratHaklada CreateShuratHaklada()
        {
            ShuratHaklada shurat_haklada = new ShuratHaklada();

            //shurat_haklada.TransactionGUID = Guid.NewGuid().ToString();
            shurat_haklada.CompanyID            = Int32.Parse(((ComboboxItem)(companyIDComboBox.SelectedItem)).Value.ToString());
            shurat_haklada.ActionCode           = Int32.Parse(((ComboboxItem)(cmbActionType.SelectedItem)).Value.ToString());
            shurat_haklada.ActionDetails        = txtActionDetails.Text;
            shurat_haklada.MisparMismach        = txtMisparMismach.GetInt();
            shurat_haklada.TarichMismach        = dtpTarichMismachNew.Value; // dtpTarichMismach.Value;
            shurat_haklada.TarichAcher          = dtpTarichAcherNew.Value;   // dtpTarichAcher.Value;
            shurat_haklada.AhuzHaMaam           = Double.Parse(txtMaam.Text);
            shurat_haklada.SchumPaturMaam       = Double.Parse(txtSchumPaturMmam.Text);
            shurat_haklada.SchumMaam            = Double.Parse(txtSchumHaMaam.Text);
            shurat_haklada.SchumKolelMaam       = Double.Parse(txtSchumKolelMaam.Text);
            shurat_haklada.Attachment           = attachmnentTextBox.Text;
            shurat_haklada.CompamyInfoCountryID = Company_Info.CompanyCountryID;
            shurat_haklada.CompamyInfoVAT       = Company_Info.CompanyVAT;
            shurat_haklada.LeTkufaMe            = dtpFrom.Value;
            shurat_haklada.LeTkufaMe            = dtpTo.Value;
            shurat_haklada.MisparProyect        = txtMisparProyect.Text;

            return(shurat_haklada);
        }
コード例 #9
0
        private void lvwOutbox_DrawSubItem(object sender, DrawListViewSubItemEventArgs e)
        {
            TextFormatFlags flags = TextFormatFlags.Left;

            using (StringFormat sf = new StringFormat())
            {
                // Store the column text alignment, letting it default
                // to Left if it has not been set to Center or Right.
                switch (e.Header.TextAlign)
                {
                case HorizontalAlignment.Center:
                    sf.Alignment = StringAlignment.Center;
                    flags        = TextFormatFlags.HorizontalCenter;
                    break;

                case HorizontalAlignment.Right:
                    sf.Alignment = StringAlignment.Far;
                    flags        = TextFormatFlags.Right;
                    break;
                }

                if (((e.ItemState & ListViewItemStates.Focused) != 0) &&
                    ((e.ItemState & ListViewItemStates.Selected) != 0) &&
                    (lvwOutbox.SelectedIndices.Count > 0)
                    )
                {
                    //e.DrawBackground();
                    e.Graphics.DrawString(e.SubItem.Text, this.Font, Brushes.White, e.Bounds, sf);
                }
                else
                {
                    e.Graphics.DrawString(e.SubItem.Text, this.Font, Brushes.Black, e.Bounds, sf);
                }

                if (e.ColumnIndex == 0)
                {
                    // Draw the subitem text in red to highlight it.
                    //e.Graphics.DrawString(e.SubItem.Text, this.Font, Brushes.Red, e.Bounds, sf);
                    if (e.Item.ImageIndex != -1)
                    {
                        e.Graphics.DrawImage(e.Item.ImageList.Images[e.Item.ImageIndex], e.SubItem.Bounds.Location);
                    }

                    ShuratHaklada shurat_haklada = (ShuratHaklada)lvwOutbox.Items[e.ItemIndex].Tag;
                    if (File.Exists(shurat_haklada.Attachment))
                    {
                        Point pt = new Point(e.SubItem.Bounds.Location.X + e.Item.ImageList.Images[0].Width, e.SubItem.Bounds.Location.Y);
                        e.Graphics.DrawImage(e.Item.ImageList.Images[5], pt);
                    }
                }
                else
                {
                    // Draw normal text for a subitem with a nonnegative
                    // or nonnumerical value.
                    //e.DrawText(flags);
                }
            }
            //TextFormatFlags flags = TextFormatFlags.Left;

            //using (StringFormat sf = new StringFormat())
            //{
            //    // Store the column text alignment, letting it default
            //    // to Left if it has not been set to Center or Right.
            //    switch (e.Header.TextAlign)
            //    {
            //        case HorizontalAlignment.Center:
            //            sf.Alignment = StringAlignment.Center;
            //            flags = TextFormatFlags.HorizontalCenter;
            //            break;
            //        case HorizontalAlignment.Right:
            //            sf.Alignment = StringAlignment.Far;
            //            flags = TextFormatFlags.Right;
            //            break;
            //    }

            //    // Unless the item is selected, draw the standard
            //    // background to make it stand out from the gradient.
            //    //if ((e.ItemState & ListViewItemStates.Selected) == 0)
            //    //{
            //    //    e.DrawBackground();
            //    //}

            //    //if (e.ColumnIndex == 0)
            //    //{
            //    if (((e.ItemState & ListViewItemStates.Focused) != 0) &&
            //         ((e.ItemState & ListViewItemStates.Selected) != 0) &&
            //         (lvwOutbox.SelectedIndices.Count > 0)
            //        )
            //    {
            //        // Draw the subitem text in red to highlight it.
            //        e.Graphics.DrawString(e.SubItem.Text, lvwOutbox.Font, Brushes.Red, e.Bounds, sf);
            //        if (e.Item.ImageIndex != -1)
            //        {
            //            e.Graphics.DrawImage(e.Item.ImageList.Images[e.Item.ImageIndex], e.SubItem.Bounds.Location);
            //        }

            //        ShuratHaklada shurat_haklada = (ShuratHaklada)lvwOutbox.Items[e.ItemIndex].Tag;
            //        if (File.Exists(shurat_haklada.Attachment))
            //        {
            //            Point pt = new Point(e.SubItem.Bounds.Location.X + e.Item.ImageList.Images[0].Width, e.SubItem.Bounds.Location.Y);
            //            e.Graphics.DrawImage(e.Item.ImageList.Images[5], pt);
            //        }
            //    }
            //    else
            //    {
            //        // Draw normal text for a subitem
            //        //e.DrawText(flags);
            //    }
            //}
        }
コード例 #10
0
        private ShuratHaklada CreateShuratHakladaDelimter(string line, string delimiter)
        {
            ShuratHaklada shurat_haklada = null;

            string[] parts = line.Split(new string[] { delimiter }, StringSplitOptions.None);


            String CountryID   = parts[0];
            String CompanyVAT  = parts[1];
            String CompanyName = parts[2].Replace("'", "''");

            Company company = CompanyIdentification.Identify(dblayer, Company_Info, null, CompanyVAT, CompanyName, null);

            if (company != null)
            {
                shurat_haklada               = new ShuratHaklada();
                shurat_haklada.CompanyID     = company.CompanyID;// dblayer.GetCompany(CountryID, CompanyVAT).CompanyID;
                shurat_haklada.ActionCode    = Convert.ToInt32(parts[3]);
                shurat_haklada.MisparMismach = Convert.ToInt32(parts[4]);

                shurat_haklada.TarichMismach = DateTime.Parse(parts[5], new System.Globalization.CultureInfo("en-AU", false)); //Convert.ToDateTime(parts[5]);
                shurat_haklada.TarichAcher   = DateTime.Parse(parts[6], new System.Globalization.CultureInfo("en-AU", false)); //Convert.ToDateTime(parts[6]);

                shurat_haklada.ActionDetails = parts[7].Replace("'", "''");;

                if (parts[8] != "")
                {
                    shurat_haklada.AhuzHaMaam = Convert.ToDouble(parts[8]);
                }
                if (parts[9] != "")
                {
                    shurat_haklada.SchumPaturMaam = Convert.ToDouble(parts[9]);
                }
                if (parts[10] != "")
                {
                    shurat_haklada.SchumMaam = Convert.ToDouble(parts[10]);
                }
                if (parts[11] != "")
                {
                    shurat_haklada.SchumKolelMaam = Convert.ToDouble(parts[11]);
                }

                shurat_haklada.Attachment = parts[12];

                if ((parts[13] != "") && (parts[13] != "0"))
                {
                    shurat_haklada.LeTkufaMe = DateTime.Parse(parts[13], new System.Globalization.CultureInfo("en-AU", false));
                }
                else
                {
                    shurat_haklada.LeTkufaMe = shurat_haklada.TarichAcher;
                }
                //shurat_haklada.LeTkufaMe = new DateTime(shurat_haklada.LeTkufaMe.Year, shurat_haklada.LeTkufaMe.Month, 1);

                if ((parts[14] != "") && (parts[14] != "0"))
                {
                    shurat_haklada.LeTkufaUd = DateTime.Parse(parts[14], new System.Globalization.CultureInfo("en-AU", false));
                }
                else
                {
                    shurat_haklada.LeTkufaUd = shurat_haklada.TarichAcher;
                }
                //shurat_haklada.LeTkufaUd = new DateTime(shurat_haklada.LeTkufaUd.Year, shurat_haklada.LeTkufaUd.Month, 1);

                shurat_haklada.MisparProyect = parts[15];

                shurat_haklada.CompamyInfoCountryID = Company_Info.CompanyCountryID;
                shurat_haklada.CompamyInfoVAT       = Company_Info.CompanyVAT;
            }

            return(shurat_haklada);
        }
コード例 #11
0
        //private void MoveAttachment(String TransactionGUID, String Attachmnent)
        //{
        //    string ServerPath = Application.StartupPath + @"\TransientStorage";

        //    if (!Directory.Exists(ServerPath))
        //    {
        //        Directory.CreateDirectory(ServerPath);
        //    }

        //    if (Company_Info.CompanyCountryID != 0)
        //    {
        //        if (!Directory.Exists(ServerPath + "/" + Company_Info.CompanyCountryID))
        //        {
        //            Directory.CreateDirectory(ServerPath + "/" + Company_Info.CompanyCountryID);
        //        }
        //    }

        //    if (Company_Info.CompanyVAT != null)
        //    {
        //        if (!Directory.Exists(ServerPath + "/" + Company_Info.CompanyCountryID + "/" + Company_Info.CompanyVAT))
        //        {
        //            Directory.CreateDirectory(ServerPath + "/" + Company_Info.CompanyCountryID + "/" + Company_Info.CompanyVAT);
        //        }
        //    }

        //    String fileName = TransactionGUID + Path.GetExtension(Attachmnent);
        //    File.Move(Attachmnent, ServerPath + "/" + Company_Info.CompanyCountryID + "/" + Company_Info.CompanyVAT + "/" + fileName);
        //}

        public void ImportHakladaMokup(String filename, CompanyInfo _companyinfo, DBLayer _dblayer, char delimiter)
        {
            Company_Info = _companyinfo;
            dblayer      = _dblayer;
            FiledHolder filedHolder = new FiledHolder();

            filedHolder.InitINI();
            filedHolder.Company_Info = Company_Info;
            filedHolder.Add("CountryID");
            filedHolder.Add("CompanyVAT");
            filedHolder.Add("CompanyName");
            filedHolder.Add("ActionCode");
            filedHolder.Add("MisparMismach");
            filedHolder.Add("TarichMismach");
            filedHolder.Add("TarichAcher");
            filedHolder.Add("ActionDetails");
            filedHolder.Add("Maam");
            filedHolder.Add("SchumPaturMaam");
            filedHolder.Add("SchumMaam");
            filedHolder.Add("SchumKolelMaam");
            filedHolder.Add("Attachment");
            filedHolder.LoadData();

            StreamReader sr   = new StreamReader(filename, CheckEncoder()); //Encoding.GetEncoding("iso-8859-8") //Hebrew From Magic
            String       line = "";
            ArrayList    flds = filedHolder.GetFileds();

            //filedHolder.GetFiled("ActionCode")
            dblayer.Current_Company_Info = _companyinfo;

            //bool bSkipRow = false;

            while (!sr.EndOfStream)
            {
                line = sr.ReadLine();
                filedHolder.CurrentDataLine = line;

                ShuratHaklada shurat_haklada = new ShuratHaklada();

                String CompanyVAT  = filedHolder.GetFiledValue(filedHolder.GetFiledPosition("CompanyVAT"), delimiter);
                String CompanyName = filedHolder.GetFiledValue(filedHolder.GetFiledOrder("CompanyName"), delimiter);

                Company company = CompanyIdentification.Identify(dblayer, Company_Info, null, CompanyVAT, CompanyName, null);

                if (company != null)
                {
                    shurat_haklada.CompanyID = company.CompanyID;

                    shurat_haklada.ActionCode           = Convert.ToInt32(filedHolder.GetFiledValue("ActionCode"));
                    shurat_haklada.MisparMismach        = Convert.ToInt32(filedHolder.GetFiledValue("MisparMismach"));
                    shurat_haklada.TarichMismach        = Convert.ToDateTime(filedHolder.GetFiledValue("TarichMismach"));
                    shurat_haklada.TarichAcher          = Convert.ToDateTime(filedHolder.GetFiledValue("TarichAcher"));
                    shurat_haklada.ActionDetails        = filedHolder.GetFiledValue("ActionDetails");
                    shurat_haklada.AhuzHaMaam           = Convert.ToDouble(filedHolder.GetFiledValue("Maam"));
                    shurat_haklada.SchumPaturMaam       = Convert.ToDouble(filedHolder.GetFiledValue("SchumPaturMaam"));
                    shurat_haklada.SchumMaam            = Convert.ToDouble(filedHolder.GetFiledValue("SchumMaam"));
                    shurat_haklada.SchumKolelMaam       = Convert.ToDouble(filedHolder.GetFiledValue("SchumKolelMaam"));
                    shurat_haklada.Attachment           = filedHolder.GetFiledValue("Attachment");
                    shurat_haklada.CompamyInfoCountryID = Company_Info.CompanyCountryID;
                    shurat_haklada.CompamyInfoVAT       = Company_Info.CompanyVAT;
                    dblayer.AddHakladaRecord(shurat_haklada);
                }
            }

            sr.Close();
        }