Пример #1
0
    protected void btngo_Click(object sender, EventArgs e)
    {
        try
        {
            #region get Value

            DataSet dsgo  = new DataSet();
            DataSet dstol = new DataSet();
            string  dept  = "";
            if (ddlCollege.Items.Count > 0)
            {
                collcode = Convert.ToString(ddlCollege.SelectedValue);
            }
            if (ddllibrary.Items.Count > 0)
            {
                libcode = Convert.ToString(ddllibrary.SelectedValue);
            }
            if (ddl_dept.Items.Count > 0)
            {
                dept = Convert.ToString(ddl_dept.SelectedValue);
            }
            string getrecord = "";
            string qrylib    = "";
            string qrylib1   = "";
            string qrydept   = "";
            //if (libcode != "All")
            //    qrylib = "AND Lib_Code='" + libcode + "'";
            if (dept != "All")
            {
                qrydept = "AND Dept_Name='" + dept + "'";
            }
            string typ1 = string.Empty;
            if (ddllibrary.Items.Count > 0)
            {
                for (int i = 0; i < ddllibrary.Items.Count - 1; i++)
                {
                    if (Convert.ToString(ddllibrary.SelectedItem) == "All")
                    {
                        if (typ1 == "")
                        {
                            typ1 = "" + ddllibrary.Items[i + 1].Value + "";
                        }
                        else
                        {
                            typ1 = typ1 + "'" + "," + "'" + ddllibrary.Items[i + 1].Value + "";
                        }
                    }
                    else
                    {
                        typ1 = ddllibrary.SelectedValue;
                    }
                }
            }

            int     sno            = 0;
            string  totitle        = "";
            string  totvol         = "";
            int     LngTotTitle    = 0;
            int     LngTotVol      = 0;
            int     LngTotNatJrnl  = 0;
            int     LngTotINatJrnl = 0;
            int     rowcount       = 0;
            DataRow dr;


            if (chkredate.Checked == false)
            {
                getrecord = "SELECT DISTINCT isnull(Dept_Name,'') Dept_Name FROM Journal_Dept WHERE 1=1  AND Lib_Code in ('" + typ1 + "') " + qrydept + " group by dept_name order by dept_name";
                dsgo.Clear();
                dsgo = d2.select_method_wo_parameter(getrecord, "Text");


                if (dsgo.Tables.Count > 0 && dsgo.Tables[0].Rows.Count > 0)
                {
                    dtcumboks.Columns.Add("SNo", typeof(string));
                    dtcumboks.Columns.Add("Department", typeof(string));
                    dtcumboks.Columns.Add("Title", typeof(string));
                    dtcumboks.Columns.Add("Volumes", typeof(string));
                    dtcumboks.Columns.Add("National Journals", typeof(string));
                    dtcumboks.Columns.Add("International Journals", typeof(string));
                    dtcumboks.Columns.Add("Remarks", typeof(string));

                    dr                           = dtcumboks.NewRow();
                    dr["SNo"]                    = "SNo";
                    dr["Department"]             = "Department";
                    dr["Title"]                  = "Title";
                    dr["Volumes"]                = "Volumes";
                    dr["National Journals"]      = "National Journals";
                    dr["International Journals"] = "International Journals";
                    dr["Remarks"]                = "Remarks";
                    dtcumboks.Rows.Add(dr);
                    for (int row = 0; row < dsgo.Tables[0].Rows.Count; row++)
                    {
                        sno++;
                        dr        = dtcumboks.NewRow();
                        dr["SNo"] = Convert.ToString(sno);
                        string dept_name = Convert.ToString(dsgo.Tables[0].Rows[row]["Dept_Name"]);
                        dr["Department"] = Convert.ToString(dsgo.Tables[0].Rows[row]["Dept_Name"]);
                        string Sql = "SELECT COUNT(DISTINCT Title) TotTitle,COUNT(*) TotVol FROM BookDetails WHERE Dept_Code ='" + dept_name + "' AND Lib_Code in ('" + typ1 + "')";
                        dstol.Clear();
                        dstol = d2.select_method_wo_parameter(Sql, "Text");
                        if (dstol.Tables[0].Rows.Count > 0)
                        {
                            totitle = Convert.ToString(dstol.Tables[0].Rows[0]["TotTitle"]);
                            totvol  = Convert.ToString(dstol.Tables[0].Rows[0]["TotVol"]);
                        }
                        else
                        {
                            totitle = "0";
                            totvol  = "0";
                        }
                        dr["Title"]   = Convert.ToString(dstol.Tables[0].Rows[row]["TotTitle"]);
                        dr["Volumes"] = Convert.ToString(dstol.Tables[0].Rows[row]["TotVol"]);
                        LngTotTitle   = LngTotTitle + Convert.ToInt32(totitle);
                        LngTotVol     = LngTotVol + Convert.ToInt32(totvol);

                        string SqlTotNat   = d2.GetFunction("SELECT COUNT(*) TotNat FROM Journal_Master WHERE Is_National = 1 AND Department ='" + dept_name + " AND Lib_Code in ('" + typ1 + "')");
                        string SqlTotInNat = d2.GetFunction("SELECT COUNT(*) TotInNat FROM Journal_Master WHERE Is_National = 0 AND Department ='" + dept_name + " AND Lib_Codein ('" + typ1 + "')");
                        LngTotNatJrnl                = LngTotNatJrnl + Convert.ToInt32(SqlTotNat);
                        LngTotINatJrnl               = LngTotINatJrnl + Convert.ToInt32(SqlTotInNat);
                        dr["National Journals"]      = SqlTotNat;
                        dr["International Journals"] = SqlTotInNat;


                        dtcumboks.Rows.Add(dr);
                    }
                    gridview1.DataSource = dtcumboks;
                    gridview1.DataBind();
                    gridview1.Visible = true;
                    rptprint.Visible  = true;
                    RowHead(gridview1);
                }
                else
                {
                    alertpopwindow.Visible = true;
                    lblalerterr.Text       = "No Record Found!";
                }
            }
            else
            {
                DataRow dr1;
                dtcumboks.Columns.Add("SNo", typeof(string));
                dtcumboks.Columns.Add("Title", typeof(string));
                dtcumboks.Columns.Add("Volumes", typeof(string));
                dtcumboks.Columns.Add("National Journals", typeof(string));
                dtcumboks.Columns.Add("International Journals", typeof(string));
                dtcumboks.Columns.Add("Remarks", typeof(string));
                dr                           = dtcumboks.NewRow();
                dr["SNo"]                    = "SNo";
                dr["Title"]                  = "Title";
                dr["Volumes"]                = "Volumes";
                dr["National Journals"]      = "National Journals";
                dr["International Journals"] = "International Journals";
                dr["Remarks"]                = "Remarks";
                dtcumboks.Rows.Add(dr);
                sno++;
                dr1 = dtcumboks.NewRow();

                string Sql = "SELECT COUNT(DISTINCT Title) TotTitle,COUNT(*) TotVol FROM BookDetails where Lib_Code in ('" + typ1 + "')";
                dstol.Clear();
                dstol = d2.select_method_wo_parameter(Sql, "Text");

                if (dstol.Tables[0].Rows.Count > 0)
                {
                    totitle = Convert.ToString(dstol.Tables[0].Rows[0]["TotTitle"]);
                    totvol  = Convert.ToString(dstol.Tables[0].Rows[0]["TotVol"]);
                }
                else
                {
                    totitle = "0";
                    totvol  = "0";
                }

                LngTotTitle    = LngTotTitle + Convert.ToInt32(totitle);
                LngTotVol      = LngTotVol + Convert.ToInt32(totvol);
                dr["SNo"]      = Convert.ToString(sno);
                dr1["Title"]   = LngTotTitle;
                dr1["Volumes"] = LngTotVol;
                string SqlTotNat1   = d2.GetFunction("SELECT COUNT(*) TotNat FROM Journal_Master WHERE Is_National = 1  AND Lib_Code in ('" + typ1 + "')");
                string SqlTotInNat1 = d2.GetFunction("SELECT COUNT(*) TotInNat FROM Journal_Master WHERE Is_National = 0 AND Lib_Code in ('" + typ1 + "')");
                LngTotNatJrnl                 = LngTotNatJrnl + Convert.ToInt32(SqlTotNat1);
                LngTotINatJrnl                = LngTotINatJrnl + Convert.ToInt32(SqlTotInNat1);
                dr1["National Journals"]      = LngTotNatJrnl;
                dr1["International Journals"] = LngTotINatJrnl;

                dtcumboks.Rows.Add(dr1);

                gridview1.DataSource = dtcumboks;
                gridview1.DataBind();
                gridview1.Visible = true;

                rptprint.Visible = true;
                RowHead(gridview1);
            }
            #endregion
        }
        catch (Exception ex) { d2.sendErrorMail(ex, userCollegeCode, "Library_Books_And_Journal_Details"); }
    }
Пример #2
0
    private void GetMPWLCDetails()
    {
        try
        {
            if (con2.State == ConnectionState.Closed)
            {
                con2.Open();
            }
            SqlDataAdapter da  = new SqlDataAdapter();
            DataSet        ds  = new DataSet();
            SqlCommand     cmd = new SqlCommand("MPSCSC_IssueCenter", con2);
            cmd.Parameters.Add("@DistrictId", SqlDbType.NVarChar, 20);
            cmd.Parameters["@DistrictId"].Value = ddlDistrictName.SelectedValue;

            cmd.CommandType = CommandType.StoredProcedure;


            da.SelectCommand = cmd;
            ds.Clear();
            da.Fill(ds);
            cmd.Dispose();


            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    ddlDepoType.DataSource     = null;
                    ddlDepoType.DataSource     = ds.Tables[0];
                    ddlDepoType.DataTextField  = "DepotName";
                    ddlDepoType.DataValueField = "DepotID";
                    ddlDepoType.DataBind();
                    ddlDepoType.Items.Insert(0, "--Select--");
                }
                else
                {
                    ddlDepoType.Items.Clear();
                    ddlDepoType.DataSource = null;
                    ddlDepoType.DataBind();
                }
            }

            else
            {
                ddlDepoType.Items.Clear();
                ddlDepoType.DataSource = null;
                ddlDepoType.DataBind();
            }
        }
        catch (Exception ex)
        {
            StringBuilder str1 = new StringBuilder();
            str1.Append("<script>");
            str1.Append("alert('" + "Some error has occured, try again" + "," + "Error:-" + ex.Message + "');</script>");
            this.Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "ClientScript", str1.ToString());
        }
        finally
        {
            if (con2.State == ConnectionState.Open)
            {
                con2.Close();
            }
        }
    }
        void cek()
        {
            Uçuş_Kayıt.classlar topla = new Uçuş_Kayıt.classlar();
            al.Clear();
            verial = new OleDbDataAdapter("select * from tablo", baglan);
            verial.Fill(al, "tablo");
            goster.Table             = al.Tables[0];
            dataGridView1.DataSource = goster;
            dataGridView1.Columns["ucus_no"].Visible = false;

            try
            {
                label11.Text = topla.top(label11.Text, 1);
                t1           = Convert.ToInt32(label11.Text);
                label12.Text = topla.top(label12.Text, 2);
                t2           = Convert.ToInt32(label12.Text);
                label13.Text = topla.top(label13.Text, 3);
                t3           = Convert.ToInt32(label13.Text);
                label14.Text = topla.top(label14.Text, 4);
                t4           = Convert.ToInt32(label14.Text);
                label15.Text = (t1 + t2 + t4 + t3).ToString();
                //
                tt1 = Convert.ToInt32(topla.top2(label16.Text, 1));
                b1  = Convert.ToInt32(topla.top2(label16.Text, 1));
                if (tt1 % 60 == 0)
                {
                    saat = tt1 / 60;
                    tt1  = 0;
                }
                else
                {
                    saat = (tt1 / 60);
                    tt1  = tt1 - (saat * 60);
                }
                if (saat == 0 && tt1 == 0)
                {
                    label16.Text = "0";
                }
                else if (tt1 == 0)
                {
                    label16.Text = saat.ToString() + " Saat";
                }
                else if (saat == 0)
                {
                    label16.Text = tt1.ToString() + " Dakika";
                }
                else
                {
                    label16.Text = saat + " Saat " + tt1.ToString() + " Dakika";
                }
                tt2 = Convert.ToInt32(topla.top2(label17.Text, 2));
                b2  = Convert.ToInt32(topla.top2(label17.Text, 2));
                if (tt2 % 60 == 0)
                {
                    saat2 = tt2 / 60;
                    tt2   = 0;
                }
                else
                {
                    saat2 = (tt2 / 60);
                    tt2   = tt2 - (saat2 * 60);
                }
                if (saat2 == 0 && tt2 == 0)
                {
                    label17.Text = "0";
                }
                else if (tt2 == 0)
                {
                    label17.Text = saat2.ToString() + " Saat";
                }
                else if (saat2 == 0)
                {
                    label17.Text = tt2.ToString() + " Dakika";
                }
                else
                {
                    label17.Text = saat2 + " Saat " + tt2.ToString() + " Dakika";
                }

                tt3 = Convert.ToInt32(topla.top2(label18.Text, 3));
                b3  = Convert.ToInt32(topla.top2(label18.Text, 3));
                if (tt3 % 60 == 0)
                {
                    saat3 = tt3 / 60;
                    tt3   = 0;
                }
                else
                {
                    saat3 = (tt3 / 60);
                    tt3   = tt3 - (saat3 * 60);
                }
                if (saat3 == 0 && tt3 == 0)
                {
                    label18.Text = "0";
                }
                else if (saat3 == 0)
                {
                    label18.Text = tt3.ToString() + " Dakika";
                }
                else if (tt3 == 0)
                {
                    label18.Text = saat3.ToString() + " Saat";
                }
                else
                {
                    label18.Text = saat3 + " Saat " + tt3.ToString() + " Dakika";
                }

                tt4 = Convert.ToInt32(topla.top2(label19.Text, 4));
                b4  = Convert.ToInt32(topla.top2(label19.Text, 4));
                if (tt4 % 60 == 0)
                {
                    saat4 = tt4 / 60;
                    tt4   = 0;
                }
                else
                {
                    saat4 = (tt4 / 60);
                    tt4   = tt4 - (saat4 * 60);
                }
                if (saat4 == 0 && tt4 == 0)
                {
                    label19.Text = "0";
                }
                else if (saat4 == 0)
                {
                    label19.Text = tt4.ToString() + " Dakika";
                }
                else if (tt4 == 0)
                {
                    label19.Text = saat4.ToString() + " Saat";
                }
                else
                {
                    label19.Text = saat4 + " Saat " + tt4.ToString() + " Dakika";
                }

                tt5 = b1 + b2 + b3 + b4;
                if (tt5 % 60 == 0)
                {
                    saat5 = tt5 / 60;
                    tt5   = 0;
                }
                else
                {
                    saat5 = (tt5 / 60);
                    tt5   = tt5 - (saat5 * 60);
                }
                if (saat5 == 0 && tt5 == 0)
                {
                    label20.Text = "0";
                }
                else if (tt5 == 0)
                {
                    label20.Text = saat5.ToString() + " Saat";
                }
                else if (saat5 == 0)
                {
                    label20.Text = tt5.ToString() + " Dakika";
                }
                else
                {
                    label20.Text = saat5 + " Saat " + tt5.ToString() + " Dakika";
                }
            }
            catch
            {
            }
        }
        /// <summary>
        /// Assigns "accountsPerProxy" number of proxies to accounts in Database, only picks up only those accounts where ProxyAddress is Null or Empty
        /// </summary>
        #region AssignProxiesToAccounts
        public void AssignProxiesToAccounts(List <string> lstProxies, int noOfAccountsPerProxy)
        {
            try
            {
                DataSet ds = new DataSet();

                if (noOfAccountsPerProxy > 0)
                {
                    accountsPerProxy = noOfAccountsPerProxy;
                }
                else
                {
                    MessageBox.Show("You entered invalid Accounts per Proxy... Default value \"10\" Set");
                }

                using (SQLiteConnection con = new SQLiteConnection(DataBaseHandler.CONstr))
                {
                    foreach (string item in lstProxies)
                    {
                        try
                        {
                            ds.Clear();

                            string account = item;

                            string proxyAddress  = string.Empty;
                            string proxyPort     = string.Empty;
                            string proxyUserName = string.Empty;
                            string proxyPassword = string.Empty;

                            int DataCount = account.Split(':').Length;

                            if (DataCount == 2)
                            {
                                proxyAddress = account.Split(':')[0];
                                proxyPort    = account.Split(':')[1];
                            }
                            else if (DataCount > 2)
                            {
                                proxyAddress  = account.Split(':')[0];
                                proxyPort     = account.Split(':')[1];
                                proxyUserName = account.Split(':')[2];
                                proxyPassword = account.Split(':')[3];
                            }

                            //using (SQLiteDataAdapter ad = new SQLiteDataAdapter("SELECT * FROM tb_FBAccount WHERE ProxyAddress = '" + proxyAddress + "'", con))
                            using (SQLiteDataAdapter ad = new SQLiteDataAdapter("SELECT * FROM tb_LinkedInAccount WHERE IPAddress = '" + proxyAddress + "' and IPPort = '" + proxyPort + "'", con))
                            {
                                ad.Fill(ds);
                                if (ds.Tables[0].Rows.Count == 0)
                                {
                                    ds.Clear();
                                    using (SQLiteDataAdapter ad1 = new SQLiteDataAdapter("SELECT * FROM tb_LinkedInAccount WHERE IPAddress = '" + "" + "' OR IPAddress = '" + null + "'", con))
                                    {
                                        ad1.Fill(ds);

                                        int count = accountsPerProxy;  //Set count = accountsPerProxy so that it sets max this number of accounts to each proxy
                                        if (ds.Tables[0].Rows.Count < count)
                                        {
                                            count = ds.Tables[0].Rows.Count;
                                        }
                                        for (int i = 0; i < count; i++)
                                        {
                                            string UpdateQuery = "Update tb_LinkedInAccount Set IPAddress='" + proxyAddress + "', IPPort='" + proxyPort + "', IPUserName='******', IPPassword='******' WHERE UserName='******'";
                                            DataBaseHandler.UpdateQuery(UpdateQuery, "tb_LinkedInAccount");
                                        }
                                    }
                                }
                            }
                        }
                        catch
                        {
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                GlobusFileHelper.AppendStringToTextfileNewLine(DateTime.Now + " --> Error --> ProxyUtillitesFromDB -- AssignProxiesToAccounts() --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_ProxySettingErroLog);
                GlobusFileHelper.AppendStringToTextfileNewLine("Error --> ProxyUtillitesFromDB -- AssignProxiesToAccounts() --> " + ex.Message + "StackTrace --> >>>" + ex.StackTrace, Globals.Path_LinkedinErrorLogs);
            }
        }
Пример #5
0
        //
        // user has clicked on a stop for more info:
        //
        private void lstStops_SelectedIndexChanged(object sender, EventArgs e)
        {
            // sometimes this event fires, but nothing is selected...
            if (this.lstStops.SelectedIndex < 0) // so return now in this case:
            {
                return;
            }

            //
            // clear GUI in case this fails:
            //
            ClearStopUI();

            //
            // now display info about this stop:
            //
            string stopName = this.lstStops.Text;

            stopName = stopName.Replace("'", "''");

            SqlConnection db = null;

            try
            {
                db = new SqlConnection(BuildConnectionString());
                db.Open();

                SqlCommand cmd = new SqlCommand();
                cmd.Connection = db;

                //
                // Let's get some info about the stop:
                //
                // NOTE: we want to use station id, not stop name,
                // because stop name is not unique.  Example: the
                // stop "Damen (Loop-bound)".s
                //
                string sql = string.Format(@"
SELECT StopID, Direction, ADA, Latitude, Longitude
FROM Stops
WHERE Name = '{0}' AND
      StationID = {1};
", stopName, this.txtStationID.Text);

                //MessageBox.Show(sql);

                SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                DataSet        ds      = new DataSet();

                cmd.CommandText = sql;
                adapter.Fill(ds);

                System.Diagnostics.Debug.Assert(ds.Tables["TABLE"].Rows.Count == 1);
                DataRow R = ds.Tables["TABLE"].Rows[0];

                // handicap accessible?
                bool accessible = Convert.ToBoolean(R["ADA"]);

                if (accessible)
                {
                    this.txtAccessible.Text = "Yes";
                }
                else
                {
                    this.txtAccessible.Text = "No";
                }

                // direction of travel:
                this.txtDirection.Text = R["Direction"].ToString();

                // lat/long position:
                this.txtLocation.Text = string.Format("({0:00.0000}, {1:00.0000})",
                                                      Convert.ToDouble(R["Latitude"]),
                                                      Convert.ToDouble(R["Longitude"]));

                //
                // now we need to know what lines are associated
                // with this stop:
                //
                int stopID = Convert.ToInt32(R["StopID"]);

                sql = string.Format(@"
SELECT Color
FROM Lines
INNER JOIN StopDetails ON Lines.LineID = StopDetails.LineID
INNER JOIN Stops ON StopDetails.StopID = Stops.StopID
WHERE Stops.StopID = {0}
ORDER BY Color ASC;
", stopID);

                //MessageBox.Show(sql);

                ds.Clear();

                cmd.CommandText = sql;
                adapter.Fill(ds);

                // display colors:
                foreach (DataRow row in ds.Tables["TABLE"].Rows)
                {
                    this.lstLines.Items.Add(row["Color"].ToString());
                }
            }
            catch (Exception ex)
            {
                string msg = string.Format("Error: '{0}'.", ex.Message);
                MessageBox.Show(msg);
            }
            finally
            {
                if (db != null && db.State == ConnectionState.Open)
                {
                    db.Close();
                }
            }
        }
Пример #6
0
 public virtual int Fill(DataSet.SheetsDataTable dataTable) {
     this.Adapter.SelectCommand = this.CommandCollection[0];
     if ((this.ClearBeforeFill == true)) {
         dataTable.Clear();
     }
     int returnValue = this.Adapter.Fill(dataTable);
     return returnValue;
 }
        public void FacturaA(PrintPageEventArgs e, int idFact)
         {
            DataSet dsRemitoA = new DataSet();
            DataSet dsFacturaA = new DataSet();
            DataSet dsEmpresa = new DataSet();
            DataSet dsCliente = new DataSet();
            DataSet dsFacturaCliente = new DataSet();

            String detalleFact;
            String idcliente;
           
            C.CargarDatos(dsFacturaA, "dsFacturaA", "select max(idfactura) from factura");

            String idFact = ((dsFacturaA.Tables[0].Rows[0][0]).ToString());

            dsFacturaA.Clear();
            C.CargarDatos(dsFacturaA, "dsFacturaA", "select flete,seguro,total from factura where idfactura=" + idFact);

            C.CargarDatos(dsRemitoA, "dsRemitoA", "select * from remito where idfactura=" + idFact);
            Console.WriteLine("select * from remito where idfactura=" + idFact);
            detalleFact = Remito.getInfoRemito(C,dsRemitoA.Tables[0].Rows[0][0].ToString());

            String fecha = DateTime.Now.ToShortDateString();

            C.CargarDatos(dsEmpresa, "dsEmpresa", "select * from empresa");

          
            String remitente = (dsEmpresa.Tables[0].Rows[0][1].ToString());
            String dirRemitente = (dsEmpresa.Tables[0].Rows[0][2].ToString());
            String telefonoEmpresa = (dsEmpresa.Tables[0].Rows[0][3].ToString());
            String ciudadRemitente = (dsEmpresa.Tables[0].Rows[0][4].ToString());
            String cuilRemitente = "";



           
            C.CargarDatos(dsFacturaCliente, "dsFacturaCliente", "select idcliente from factura where idfactura=" + idFact);

            idcliente = dsFacturaCliente.Tables[0].Rows[0][0].ToString();
           
            C.CargarDatos(dsCliente,"dsCliente","select nombre,apellido,direccion,CUIL,ciudad from clientes where idcliente=" + idcliente);
           
           

            String destinatario = (dsCliente.Tables[0].Rows[0][0].ToString()+ " "+dsCliente.Tables[0].Rows[0][1].ToString());
            String dirDestinatario = (dsCliente.Tables[0].Rows[0][2].ToString());
            String ciudadDestinatario = (dsCliente.Tables[0].Rows[0][4].ToString());
            String cuilDestinatario = (dsCliente.Tables[0].Rows[0][3].ToString());

            String IVA = (dsRemitoA.Tables[0].Rows[0][11].ToString());

            String VD = (dsRemitoA.Tables[0].Rows[0][12].ToString());
            String CR = (dsRemitoA.Tables[0].Rows[0][13].ToString());

            String condVenta = (dsRemitoA.Tables[0].Rows[0][10].ToString());

            DataSet aux = new DataSet();
            C.CargarDatos(aux, "aux", "select flete,seguro,total,neto,ivari from factura where idfactura=" + idFact);

            String flete = (aux.Tables[0].Rows[0][0].ToString()); ;
            String seguro = (aux.Tables[0].Rows[0][1].ToString()); ;
            String total = (aux.Tables[0].Rows[0][2].ToString()); ;
            String neto = (aux.Tables[0].Rows[0][3].ToString());
            String ivari = (aux.Tables[0].Rows[0][4].ToString()); 

            Font font = new Font("Tahoma", 10, FontStyle.Bold);

            //Imprime la fecha actual
            //Fecha 1100 / 1170 / 1250 - 270
            e.Graphics.DrawString(fecha, font, Brushes.Black, PrinterUnitConvert.Convert(1050, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display), PrinterUnitConvert.Convert(200, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display));

            
      
            //Remitente 400 - 550
            e.Graphics.DrawString(remitente, font, Brushes.Black, PrinterUnitConvert.Convert(390, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display), PrinterUnitConvert.Convert(480, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display));
            //Destinatario 1200 - 550 
            e.Graphics.DrawString(destinatario, font, Brushes.Black, PrinterUnitConvert.Convert(1190, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display), PrinterUnitConvert.Convert(480, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display));
            //Domicilio 380 - 610
            e.Graphics.DrawString(dirRemitente, font, Brushes.Black, PrinterUnitConvert.Convert(370, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display), PrinterUnitConvert.Convert(540, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display));
            //Domicilio 1160 - 610
            e.Graphics.DrawString(dirDestinatario, font, Brushes.Black, PrinterUnitConvert.Convert(1140, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display), PrinterUnitConvert.Convert(540, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display));
            //Localidad 400 - 670
            e.Graphics.DrawString(ciudadRemitente, font, Brushes.Black, PrinterUnitConvert.Convert(390, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display), PrinterUnitConvert.Convert(590, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display));
            //Localidad 1170 - 670
            e.Graphics.DrawString(ciudadDestinatario, font, Brushes.Black, PrinterUnitConvert.Convert(1190, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display), PrinterUnitConvert.Convert(590, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display));
            //C.U.I.T. 340 - 730
            e.Graphics.DrawString(cuilRemitente, font, Brushes.Black, PrinterUnitConvert.Convert(340, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display), PrinterUnitConvert.Convert(660, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display));
            //C.U.I.T. 1120 - 730
            e.Graphics.DrawString(cuilDestinatario, font, Brushes.Black, PrinterUnitConvert.Convert(1110, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display), PrinterUnitConvert.Convert(660, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display));
        
               
            //Cuenta Corriente 910 - 800
            e.Graphics.DrawString("x", font, Brushes.Black, PrinterUnitConvert.Convert(820, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display), PrinterUnitConvert.Convert(735, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display));
            //Flete
            //A cobrar 1180 - 1420
            e.Graphics.DrawString(flete, font, Brushes.Black, PrinterUnitConvert.Convert(1160, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display), PrinterUnitConvert.Convert(1350, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display));
            //seguro
            //A cobrar 1180 - 1480
            e.Graphics.DrawString(seguro, font, Brushes.Black, PrinterUnitConvert.Convert(1160, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display), PrinterUnitConvert.Convert(1410, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display));
            //total
            //A cobrar 1180 - 1720
            e.Graphics.DrawString(total, font, Brushes.Black, PrinterUnitConvert.Convert(1160, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display), PrinterUnitConvert.Convert(1670, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display));


            //Neto
            e.Graphics.DrawString(neto, font, Brushes.Black, PrinterUnitConvert.Convert(1150, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display), PrinterUnitConvert.Convert(1480, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display));
            //IVA R.I.
            e.Graphics.DrawString(ivari, font, Brushes.Black, PrinterUnitConvert.Convert(1150, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display), PrinterUnitConvert.Convert(1550, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display));

            List<String> detalleDividido = new List<String>(7);
            detalleFact=richTextDescripcion.Text.ToString();
            detalleDividido=dividirDescripcion(detalleFact);

            e.Graphics.DrawString(detalleDividido.ElementAt(0), font, Brushes.Black, PrinterUnitConvert.Convert(320, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display), PrinterUnitConvert.Convert(900, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display));
            e.Graphics.DrawString(detalleDividido.ElementAt(1), font, Brushes.Black, PrinterUnitConvert.Convert(320, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display), PrinterUnitConvert.Convert(950, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display));
            e.Graphics.DrawString(detalleDividido.ElementAt(2), font, Brushes.Black, PrinterUnitConvert.Convert(320, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display), PrinterUnitConvert.Convert(1000, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display));
            e.Graphics.DrawString(detalleDividido.ElementAt(3), font, Brushes.Black, PrinterUnitConvert.Convert(320, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display), PrinterUnitConvert.Convert(1050, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display));
            e.Graphics.DrawString(detalleDividido.ElementAt(4), font, Brushes.Black, PrinterUnitConvert.Convert(320, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display), PrinterUnitConvert.Convert(1100, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display));
            e.Graphics.DrawString(detalleDividido.ElementAt(5), font, Brushes.Black, PrinterUnitConvert.Convert(320, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display), PrinterUnitConvert.Convert(1150, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display));
            e.Graphics.DrawString(detalleDividido.ElementAt(6), font, Brushes.Black, PrinterUnitConvert.Convert(320, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display), PrinterUnitConvert.Convert(1200, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display));
        
        
            //Resp. Insc. 1220 - 800
            e.Graphics.DrawString("x", font, Brushes.Black, PrinterUnitConvert.Convert(1160, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display), PrinterUnitConvert.Convert(745, PrinterUnit.TenthsOfAMillimeter, PrinterUnit.Display));            
        }//end printFacturaA
Пример #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ClUsuario     = new Cl_Usuario();
            ClUtilitarios = new Cl_Utilitarios();
            ClPersona     = new Cl_Persona();
            ClManejo      = new Cl_Manejo();
            ClRegistro    = new Cl_Registro();
            ClInmueble    = new Cl_Inmueble();
            Cl_Gestion    = new Cl_Gestion_Registro();

            GrdPlanesSolicitados.NeedDataSource            += GrdPlanesSolicitados_NeedDataSource;
            GrdPlanesSolicitadosComoRegente.NeedDataSource += GrdPlanesSolicitadosComoRegente_NeedDataSource;
            GrdPlanesSolicitadosComoRegente.ItemCommand    += GrdPlanesSolicitadosComoRegente_ItemCommand;
            GrdPlanesSolicitadosComoRegente.ItemDataBound  += GrdPlanesSolicitadosComoRegente_ItemDataBound;
            GrdPlanesSolicitados.ItemDataBound             += GrdPlanesSolicitados_ItemDataBound;
            GrdPlanesSolicitados.ItemCommand += GrdPlanesSolicitados_ItemCommand;
            BtnYes.ServerClick += BtnYes_ServerClick;

            if (Session["UsuarioId"] == null)
            {
                Response.Redirect("~/Wfrm_Login.aspx");
            }
            else if (!IsPostBack)
            {
                ClUsuario.Insertar_Ingreso_Pagina(46, Convert.ToInt32(Session["UsuarioId"]), ClUsuario.CorrId_IngresoPagina());
                ClUtilitarios.Permisos(Master, Convert.ToInt32(Session["UsuarioId"]));
                System.Web.UI.WebControls.Label LblPerfil;
                LblPerfil      = (System.Web.UI.WebControls.Label)Master.FindControl("LblTipoUsuario");
                LblPerfil.Text = ClUsuario.Get_Tipo_Usuario(Convert.ToInt32(Session["UsuarioId"]));

                System.Web.UI.WebControls.Label LblUsuario;
                LblUsuario      = (System.Web.UI.WebControls.Label)Master.FindControl("lblUsuario");
                LblUsuario.Text = ClPersona.Nombre_Usuario(Convert.ToInt32(Session["PersonaId"]));


                DataSet dsPermisos = ClUsuario.Get_Roles(Convert.ToInt32(Session["UsuarioId"]), 46);
                if (Convert.ToInt32(dsPermisos.Tables["Datos"].Rows[0]["Editar"]) == 0)
                {
                }
                if (Convert.ToInt32(dsPermisos.Tables["Datos"].Rows[0]["Insertar"]) == 0)
                {
                }
                if (Convert.ToInt32(dsPermisos.Tables["Datos"].Rows[0]["Eliminar"]) == 0)
                {
                }
                dsPermisos.Clear();


                System.Web.UI.HtmlControls.HtmlImage ImgPerfilFake;
                System.Web.UI.WebControls.Image      ImgPerfil;
                ImgPerfilFake = (System.Web.UI.HtmlControls.HtmlImage)Master.FindControl("ImgPerfilFake");
                ImgPerfil     = (System.Web.UI.WebControls.Image)Master.FindControl("ImgPerfil");

                if (ClPersona.Existe_FotoPerfil(Convert.ToInt32(Session["PersonaId"])) == true)
                {
                    ImgPerfilFake.Visible = false;
                    ImgPerfil.Visible     = true;
                }
                else
                {
                    ImgPerfilFake.Visible = true;
                    ImgPerfil.Visible     = false;
                    if (ClPersona.Genero_Usuario(Convert.ToInt32(Session["PersonaId"])) == 1)
                    {
                        ImgPerfilFake.Src = "../imagenes/male.png";
                    }

                    else
                    {
                        ImgPerfilFake.Src = "../imagenes/female.png";
                    }
                }

                int EsEMPF = ClRegistro.EsElaboradorPM_Activo(Convert.ToInt32(Session["PersonaId"]));
                if (EsEMPF == 0)
                {
                    DivTitPlanProceso.Visible = false;
                    DivPlanProceso.Visible    = false;
                }
            }
        }
Пример #9
0
        public void Clear()
        {
            var ds = new DataSet();
            ds.Tables.Add(DataProvider.CreateParentDataTable());
            ds.Tables[0].Rows.Add(new object[] { 9, "", "" });

            // Clear
            ds.Clear();
            Assert.Equal(0, ds.Tables[0].Rows.Count);
        }
Пример #10
0
        public void Clear_WithNoDataWithConstraint()
        {
            // Test dataset with no data and with constraint
            var ds = new DataSet();
            ds.Tables.Add(DataProvider.CreateParentDataTable());
            ds.Tables.Add(DataProvider.CreateChildDataTable());
            ds.Tables[0].Rows.Clear();
            ds.Tables[1].Rows.Clear();

            ds.Tables[0].Constraints.Add("test", ds.Tables[1].Columns[0], ds.Tables[0].Columns[0]);
            ds.Clear();
        }
Пример #11
0
 public virtual int FillByTitleId(DataSet.CredentialDataTable dataTable, long TitleId) {
     this.Adapter.SelectCommand = this.CommandCollection[1];
     this.Adapter.SelectCommand.Parameters[0].Value = ((long)(TitleId));
     if ((this.ClearBeforeFill == true)) {
         dataTable.Clear();
     }
     int returnValue = this.Adapter.Fill(dataTable);
     return returnValue;
 }
Пример #12
0
 public virtual int FillBySubscriberId(DataSet.TokenDataTable dataTable, long SubscriberId) {
     this.Adapter.SelectCommand = this.CommandCollection[2];
     this.Adapter.SelectCommand.Parameters[0].Value = ((long)(SubscriberId));
     if ((this.ClearBeforeFill == true)) {
         dataTable.Clear();
     }
     int returnValue = this.Adapter.Fill(dataTable);
     return returnValue;
 }
Пример #13
0
 public virtual int FillByBody(DataSet.TokenDataTable dataTable, string Body) {
     this.Adapter.SelectCommand = this.CommandCollection[1];
     if ((Body == null)) {
         throw new global::System.ArgumentNullException("Body");
     }
     else {
         this.Adapter.SelectCommand.Parameters[0].Value = ((string)(Body));
     }
     if ((this.ClearBeforeFill == true)) {
         dataTable.Clear();
     }
     int returnValue = this.Adapter.Fill(dataTable);
     return returnValue;
 }
Пример #14
0
        private void RPTARPaymentHis_Load(object sender, EventArgs e)
        {
            CR_ARPaymentHistory rptARPayHis = new CR_ARPaymentHistory();
            SqlConnection       conTrial    = new SqlConnection(GeneralFunctions.ConnectionString);
            SqlCommand          comTrial    = new SqlCommand();
            SqlCommand          comSUM      = new SqlCommand();
            SqlDataAdapter      adapTrial   = new SqlDataAdapter();

            DataSet dsTrial = new DataSet();

            dsTrial.Clear();
            try
            {
                TotalPaymentAmt    = 0;
                comSUM.Connection  = conTrial;
                comSUM.CommandText = "SELECT DISTINCT TransNO, Payment_Amount FROM RPTPaymentHistory";
                if (conTrial.State == ConnectionState.Closed)
                {
                    conTrial.Open();
                }
                SqlDataReader dr = comSUM.ExecuteReader();
                if (dr.HasRows == true)
                {
                    while (dr.Read())
                    {
                        if (double.Parse(dr["Payment_Amount"].ToString()) > 0)
                        {
                            TotalPaymentAmt += (double.Parse(dr["Payment_Amount"].ToString()) * -1);
                        }
                        else
                        {
                            TotalPaymentAmt += double.Parse(dr["Payment_Amount"].ToString());
                        }
                    }
                }
                if (conTrial.State == ConnectionState.Open)
                {
                    conTrial.Close();
                }
                comTrial.Connection     = conTrial;
                comTrial.CommandType    = CommandType.Text;
                comTrial.CommandText    = "Select * From RPTPaymentHistory";
                adapTrial.SelectCommand = comTrial;
                adapTrial.Fill(dsTrial, "RPTPaymentHistory");
                rptARPayHis.SetDataSource(dsTrial);

                CrystalDecisions.CrystalReports.Engine.TextObject txtFrom;
                CrystalDecisions.CrystalReports.Engine.TextObject txtTo;
                CrystalDecisions.CrystalReports.Engine.TextObject txtTitle;
                CrystalDecisions.CrystalReports.Engine.TextObject Text7;
                CrystalDecisions.CrystalReports.Engine.TextObject Text16;
                CrystalDecisions.CrystalReports.Engine.TextObject Text22;


                txtFrom      = (CrystalDecisions.CrystalReports.Engine.TextObject)rptARPayHis.ReportDefinition.ReportObjects["txtFrom"];
                txtFrom.Text = RPTARPaymentHistory.txtFrom;

                txtTo      = (CrystalDecisions.CrystalReports.Engine.TextObject)rptARPayHis.ReportDefinition.ReportObjects["txtTo"];
                txtTo.Text = RPTARPaymentHistory.txtTo;

                txtTitle = (CrystalDecisions.CrystalReports.Engine.TextObject)rptARPayHis.ReportDefinition.ReportObjects["txtTitle"];
                Text7    = (CrystalDecisions.CrystalReports.Engine.TextObject)rptARPayHis.ReportDefinition.ReportObjects["Text7"];
                Text16   = (CrystalDecisions.CrystalReports.Engine.TextObject)rptARPayHis.ReportDefinition.ReportObjects["Text16"];
                Text22   = (CrystalDecisions.CrystalReports.Engine.TextObject)rptARPayHis.ReportDefinition.ReportObjects["Text22"];
                if (RPTARPaymentHistory.txtReport == "Credit")
                {
                    txtTitle.Text = "AR Credit Report";
                    Text7.Text    = "Credit_Amount";
                    Text16.Text   = "Total Credit :";
                    Text22.Text   = "Total Unapplied Credit :";
                }
                else if (RPTARPaymentHistory.txtReport == "Payment")
                {
                    txtTitle.Text = "AR Payment History Report";
                    Text7.Text    = "Payment_Amount";
                    Text16.Text   = "Total Payments :";
                    Text22.Text   = "Total Unapplied Payments :";
                }
                else
                {
                    txtTitle.Text = "AR Payment And Credit Report";
                    Text7.Text    = "Amount";
                    Text16.Text   = "Total :";
                    Text22.Text   = "Total Unapplied :";
                }
                CrystalDecisions.CrystalReports.Engine.FieldObject AmountApplied1;
                CrystalDecisions.CrystalReports.Engine.FieldObject PaymentAmount1;
                CrystalDecisions.CrystalReports.Engine.FieldObject TotalPayment1;
                CrystalDecisions.CrystalReports.Engine.FieldObject SumofAmountApplied1;
                CrystalDecisions.CrystalReports.Engine.FieldObject TotalUnappied1;

                AmountApplied1      = (CrystalDecisions.CrystalReports.Engine.FieldObject)rptARPayHis.ReportDefinition.ReportObjects["AmountApplied1"];
                PaymentAmount1      = (CrystalDecisions.CrystalReports.Engine.FieldObject)rptARPayHis.ReportDefinition.ReportObjects["PaymentAmount1"];
                TotalPayment1       = (CrystalDecisions.CrystalReports.Engine.FieldObject)rptARPayHis.ReportDefinition.ReportObjects["TotalPayment1"];
                SumofAmountApplied1 = (CrystalDecisions.CrystalReports.Engine.FieldObject)rptARPayHis.ReportDefinition.ReportObjects["SumofAmountApplied1"];
                TotalUnappied1      = (CrystalDecisions.CrystalReports.Engine.FieldObject)rptARPayHis.ReportDefinition.ReportObjects["TotalUnappied1"];

                AmountApplied1.FieldFormat.NumericFormat.DecimalPlaces      = decmial;
                PaymentAmount1.FieldFormat.NumericFormat.DecimalPlaces      = decmial;
                TotalPayment1.FieldFormat.NumericFormat.DecimalPlaces       = decmial;
                SumofAmountApplied1.FieldFormat.NumericFormat.DecimalPlaces = decmial;
                TotalUnappied1.FieldFormat.NumericFormat.DecimalPlaces      = decmial;

                rptARPayHis.SetParameterValue(0, TotalPaymentAmt);

                this.crystalReportViewer1.ReportSource = rptARPayHis;
                crystalReportViewer1.Zoom(100);
            }
            catch (Exception e3)
            {
                MessageBox.Show(e3.Message);
            }
        }
Пример #15
0
 //返回取消列表
 private void LoadCancelList()
 {
     System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection();
     conn.ConnectionString = rms_var.ConnStr;
     try
     {
         SqlCommand selectCMD = new SqlCommand("SELECT * FROM CancelReason", conn);
         selectCMD.CommandTimeout = 30;
         SqlDataAdapter dbDA = new SqlDataAdapter();
         dbDA.SelectCommand = selectCMD;
         conn.Open();
         DataSet dbDS = new DataSet();
         dbDS.Clear();
         dbDA.Fill(dbDS, "CancelReason");
         //dgCancelReason.DataSource = Nothing
         //dgCancelReason.DataSource = dbDS
         //dgCancelReason.DataMember = "CancelReason"
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         conn.Close();
     }
 }
Пример #16
0
        public JoinKoubeiModel getInfoFromMainInfo(string InfoType, long InfoID, string AreaAll)
        {
            JoinKoubeiModel model = new JoinKoubeiModel();

            //商机15,创业7,招商13,项目19,投资6
            //信息类别,信息表类型,获取信息From,获取信息Field,
            //string[] tableInfo = new string[] {
            //    "Oppor;OpportunityInfoTab;MainInfoTab left join OpportunityInfoTab on MainInfoTab.ID=OpportunityInfoTab.InfoID left join SetCountyTab on OpportunityInfoTab.CountyID=SetCountyTab.CountyID;Title,publishT,InfoTypeID,ValidateStartTime,ValidateTerm,TemplateID,HtmlFile,CountyName,Content,ComName,LinkMan,Tel,Mobile,Email",
            //    "CarveOut;CarveOutInfoTab;MainInfoTab left join CarveOutInfoTab on MainInfoTab.ID=CarveOutInfoTab.InfoID left join SetCountyTab on CarveOutInfoTab.CountyID=SetCountyTab.CountyID;Title,publishT,InfoTypeID,ValidateStartTime,ValidateTerm,TemplateID,HtmlFile,CountyName,Content,ComName,LinkMan,Tel,Mobile,Email",
            //    "Merchant;MerchantInfoTab;MainInfoTab left join MerchantInfoTab on MainInfoTab.ID=MerchantInfoTab.InfoID left join InfoContactTab on MerchantInfoTab.InfoID=InfoContactTab.InfoID left join SetCountyTab on MerchantInfoTab.CountyID=SetCountyTab.CountyID;Title,publishT,InfoTypeID,ValidateStartTime,ValidateTerm,TemplateID,HtmlFile,CountyName,ZoneAbout as Content,OrganizationName as ComName,Name as LinkMan,Ltrim(Rtrim(TelStateCode))+'-'+Ltrim(Rtrim(TelNum)) as Tel,Mobile,Email",
            //    "Project;ProjectInfoTab;MainInfoTab left join ProjectInfoTab on MainInfoTab.ID=ProjectInfoTab.InfoID left join InfoContactTab on ProjectInfoTab.InfoID=InfoContactTab.InfoID left join SetCountyTab on ProjectInfoTab.CountyID=SetCountyTab.CountyID;Title,publishT,InfoTypeID,ValidateStartTime,ValidateTerm,TemplateID,HtmlFile,CountyName,ComAbout as Content,OrganizationName as ComName,Name as LinkMan,Ltrim(Rtrim(TelStateCode))+'-'+Ltrim(Rtrim(TelNum)) as Tel,Mobile,Email",
            //    "Capital;CapitalInfoTab;MainInfoTab left join CapitalInfoTab on MainInfoTab.ID=CapitalInfoTab.InfoID left join InfoContactTab on CapitalInfoTab.InfoID=InfoContactTab.InfoID left join CapitalInfoAreaTab on CapitalInfoTab.InfoID=CapitalInfoAreaTab.InfoID left join SetCountyTab on CapitalInfoAreaTab.CountyID=SetCountyTab.CountyID;Title,publishT,InfoTypeID,ValidateStartTime,ValidateTerm,TemplateID,HtmlFile,CountyName,ComAbout as Content,OrganizationName as ComName,Name as LinkMan,Ltrim(Rtrim(TelStateCode))+'-'+Ltrim(Rtrim(TelNum)) as Tel,Mobile,Email"
            //};
            string[] tableInfo = new string[] {
                "15;OpportunityInfoTab;MainInfoTab left join OpportunityInfoTab on MainInfoTab.ID=OpportunityInfoTab.InfoID left join SetCountyTab on OpportunityInfoTab.CountyID=SetCountyTab.CountyID left join SetProvinceTab on OpportunityInfoTab.ProvinceID=SetProvinceTab.ProvinceID left join SetCountryTab on SetCountryTab.CountryCode=OpportunityInfoTab.CountryCode;Title,publishT,InfoTypeID,ValidateStartTime,ValidateTerm,TemplateID,HtmlFile,CountyName,Content,ComName,LinkMan,Tel,Mobile,Email,ProvinceName,CountryName",
                "7;CarveOutInfoTab;MainInfoTab left join CarveOutInfoTab on MainInfoTab.ID=CarveOutInfoTab.InfoID left join SetCountyTab on CarveOutInfoTab.CountyID=SetCountyTab.CountyID left join SetProvinceTab on CarveOutInfoTab.ProvinceID=SetProvinceTab.ProvinceID left join SetCountryTab on SetCountryTab.CountryCode=CarveOutInfoTab.CountryCode;Title,publishT,InfoTypeID,ValidateStartTime,ValidateTerm,TemplateID,HtmlFile,CountyName,Content,ComName,LinkMan,Tel,Mobile,Email,ProvinceName,CountryName",
                "13;MerchantInfoTab;MainInfoTab left join MerchantInfoTab on MainInfoTab.ID=MerchantInfoTab.InfoID left join InfoContactTab on MerchantInfoTab.InfoID=InfoContactTab.InfoID left join SetCountyTab on MerchantInfoTab.CountyID=SetCountyTab.CountyID left join SetProvinceTab on MerchantInfoTab.ProvinceID=SetProvinceTab.ProvinceID left join SetCountryTab on SetCountryTab.CountryCode=MerchantInfoTab.CountryCode;Title,publishT,InfoTypeID,ValidateStartTime,ValidateTerm,TemplateID,HtmlFile,CountyName,ZoneAbout as Content,OrganizationName as ComName,Name as LinkMan,Ltrim(Rtrim(TelStateCode))+'-'+Ltrim(Rtrim(TelNum)) as Tel,Mobile,Email,ProvinceName,CountryName",
                "19;ProjectInfoTab;MainInfoTab left join ProjectInfoTab on MainInfoTab.ID=ProjectInfoTab.InfoID left join InfoContactTab on ProjectInfoTab.InfoID=InfoContactTab.InfoID left join SetCountyTab on ProjectInfoTab.CountyID=SetCountyTab.CountyID left join SetProvinceTab on ProjectInfoTab.ProvinceID=SetProvinceTab.ProvinceID left join SetCountryTab on SetCountryTab.CountryCode=ProjectInfoTab.CountryCode;Title,publishT,InfoTypeID,ValidateStartTime,ValidateTerm,TemplateID,HtmlFile,CountyName,ComAbout as Content,OrganizationName as ComName,Name as LinkMan,Ltrim(Rtrim(TelStateCode))+'-'+Ltrim(Rtrim(TelNum)) as Tel,Mobile,Email,ProvinceName,CountryName",
                "6;CapitalInfoTab;MainInfoTab left join CapitalInfoTab on MainInfoTab.ID=CapitalInfoTab.InfoID left join InfoContactTab on CapitalInfoTab.InfoID=InfoContactTab.InfoID left join CapitalInfoAreaTab on CapitalInfoTab.InfoID=CapitalInfoAreaTab.InfoID left join SetCountyTab on CapitalInfoAreaTab.CountyID=SetCountyTab.CountyID left join SetProvinceTab on CapitalInfoAreaTab.ProvinceID=SetProvinceTab.ProvinceID left join SetCountryTab on SetCountryTab.CountryCode=CapitalInfoAreaTab.CountryCode;Title,publishT,InfoTypeID,ValidateStartTime,ValidateTerm,TemplateID,HtmlFile,CountyName,ComAbout as Content,OrganizationName as ComName,Name as LinkMan,Ltrim(Rtrim(TelStateCode))+'-'+Ltrim(Rtrim(TelNum)) as Tel,Mobile,Email,ProvinceName,CountryName"
            };
            int type = 0;

            switch (InfoType.ToString())
            {
            case "Oppor": type = 1; break;

            case "CarveOut": type = 2; break;

            case "Merchant": type = 3; break;

            case "Project": type = 4; break;

            case "Capital": type = 5; break;

            default: type = 0; break;
            }
            if (type == 0)
            {
                return(model);
            }
            string  selectField  = tableInfo[(type - 1)].Split(';')[3];
            string  selectTables = tableInfo[(type - 1)].Split(';')[2];
            string  selectTable  = tableInfo[(type - 1)].Split(';')[1];
            string  sqlStr       = "select " + selectField + " from " + selectTables + " where " + selectTable + ".InfoID=" + InfoID.ToString();
            DataSet ds           = DbHelperSQL.Query(sqlStr);

            if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
            {
                DataRow dr = ds.Tables[0].Rows[0];
                model.Join_Content   = dr["Content"].ToString().Trim();         //内容
                model.Join_StartTime = Convert.ToDateTime(dr["ValidateStartTime"].ToString().Trim());
                //model.Join_EndTime = model.Join_StartTime.AddDays(25);
                DateTime endTimeTemp = new DateTime();
                switch (dr["ValidateTerm"].ToString().Trim())
                {
                case "3": endTimeTemp = model.Join_StartTime.AddDays(90); break;

                case "6": endTimeTemp = model.Join_StartTime.AddDays(180); break;

                case "12": endTimeTemp = model.Join_StartTime.AddDays(360); break;
                }
                double days = 0;
                try
                {
                    days = Convert.ToDouble(endDays);
                }
                catch
                {
                    days = 7;
                }
                if (endTimeTemp >= System.DateTime.Now.AddDays(days) || endTimeTemp <= System.DateTime.Now)
                {
                    model.Join_EndTime = System.DateTime.Now.AddDays(days);
                }
                else
                {
                    model.Join_EndTime = endTimeTemp;
                }

                model.Join_LinkMan    = dr["LinkMan"].ToString().Trim();
                model.Join_Tel        = dr["Tel"].ToString().Trim();
                model.Join_Tel2       = dr["Mobile"].ToString().Trim();
                model.Join_Email      = dr["Email"].ToString().Trim();
                model.Join_Title      = dr["Title"].ToString().Trim();
                model.Join_CountyName = dr["CountyName"].ToString().Trim();
                //int areaIndex = AreaAll.IndexOf("," + dr["CountyName"].ToString().Trim() + ",");
                //if (areaIndex != -1)
                //    model.Join_AreaCode = AreaAll.Substring(0, areaIndex).Split(',').Length + 2;
                //else
                //    model.Join_AreaCode = 0;

                //ProvinceName,CountryName
                int areaIndex = AreaAll.IndexOf("," + dr["CountyName"].ToString().Trim() + ",");    //县级区域
                if (areaIndex == -1)
                {
                    areaIndex = AreaAll.IndexOf("," + dr["ProvinceName"].ToString().Trim() + ",");  //省级
                    if (areaIndex == -1)
                    {
                        areaIndex = AreaAll.IndexOf("," + dr["CountryName"].ToString().Trim() + ",");//国家
                        if (areaIndex == -1)
                        {
                            string CountryNameTemp = dr["CountryName"].ToString().Trim().Replace("中国", "");//如果是中国国香港 或者台湾的时候
                            //CountryName
                            areaIndex = AreaAll.IndexOf("," + CountryNameTemp.Trim() + ",");
                        }
                    }
                }
                if (areaIndex != -1)
                {
                    model.Join_AreaCode = AreaAll.Substring(0, areaIndex).Split(',').Length + 2;
                }
                else
                {
                    model.Join_AreaCode = 0;
                }

                model.Join_URL = dr["HtmlFile"].ToString();
            }
            ds.Clear();
            return(model);
        }
Пример #17
0
 private void GetCancels()
 {
     if (CancelFoodRsnBtnList != null)
     {
         CancelFoodRsnBtnList.RemoveAll();
         CancelFoodRsnBtnList = null;
     }
     CancelFoodRsnBtnList = new CancelFoodRsnButtonList(Panel1, 74, 40, Color.LightBlue, Color.FromArgb(255, 128, 128), 4);
     System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection();
     conn.ConnectionString = rms_var.ConnStr;
     try
     {
         SqlCommand selectCMD = new SqlCommand("SELECT * FROM CancelReason", conn);
         selectCMD.CommandTimeout = 30;
         SqlDataAdapter dbDA = new SqlDataAdapter();
         dbDA.SelectCommand = selectCMD;
         conn.Open();
         DataSet dbDS = new DataSet();
         dbDS.Clear();
         dbDA.Fill(dbDS, "t");
         for (int i = 0; i <= dbDS.Tables[0].Rows.Count - 1; i++)
         {
             CancelFoodRsnBtnList.AddNewButton(dbDS.Tables[0].Rows[i]["reason"].ToString());
         }
         CancelReason = dbDS.Tables[0].Rows[0]["reason"].ToString();
         CancelFoodRsnBtnList.SelectItem(0);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         conn.Close();
     }
 }
Пример #18
0
        // Form yüklenme esnasındaki action
        private void FrmCalisanEkle_Load(object sender, EventArgs e)
        {
            // masked text boxa başlangıç değeri verildi
            maskedTextBoxMaas.Text = "000000  ₺ (tl)";
            // Bolum ve departman tablolarına bağlanarak istenilen veirler çekildi comboboxlara yazdırıldı , Çalışan eklemek  gerekli veriler ve ıd bulundu

            SqlCommand komut = new SqlCommand();

            komut.CommandText = "SELECT *FROM Bolumler";
            komut.Connection  = baglanti;
            komut.CommandType = CommandType.Text;

            SqlDataReader dr;

            baglanti.Open();
            dr = komut.ExecuteReader();

            string ad;
            int    id;

            while (dr.Read())
            {
                ad = Convert.ToString(dr["Bolum_Adı"]);
                id = Convert.ToInt32(dr["Bolum_id"]);
                comboBoxBolum.Items.Add(ad + "(" + id + ")");
            }
            baglanti.Close();


            komut.CommandText = "SELECT *FROM Departmanlar";
            komut.Connection  = baglanti;
            komut.CommandType = CommandType.Text;


            baglanti.Open();
            dr = komut.ExecuteReader();


            while (dr.Read())
            {
                ad = Convert.ToString(dr["Departman_Adi"]);
                id = Convert.ToInt32(dr["Departman_Id"]);
                comboBoxDepartman.Items.Add(ad + "(" + id + ")");
            }
            baglanti.Close();
            dateTimePickerTarih.Value = Convert.ToDateTime(DateTime.Now.ToShortDateString());

            SqlCommand cmd = new SqlCommand();

            cmd.Connection = baglanti;



            baglanti.Open();
            string         calisanekleid = null;
            DataSet        ds2           = new DataSet();
            SqlDataAdapter da2           = new SqlDataAdapter("SELECT * FROM Calisan", baglanti);

            ds2.Clear();
            da2.Fill(ds2, "Calisan");
            calisanekleid = ds2.Tables["Calisan"].Rows.Count.ToString();
            calisanekleid = Convert.ToString(Convert.ToInt32(calisanekleid) + 1);
            labelId.Text  = calisanekleid;
            baglanti.Close();
        }
Пример #19
0
            //填充操作员信息 LogOperatorID
            public static void ReceiveOperatorInfo(string userid)
            {
                //根据LogOperator返回雇员信息
                opinfo.OpID = userid;
                System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection();
                conn.ConnectionString = ConnStr;
                try
                {
                    SqlCommand selectCMD = new SqlCommand("SELECT * FROM Operator where OperatorID='" + userid + "'", conn);
                    selectCMD.CommandTimeout = 30;
                    SqlDataAdapter dbDA = new SqlDataAdapter();
                    dbDA.SelectCommand = selectCMD;
                    conn.Open();
                    DataSet dbDS = new DataSet();
                    dbDA.Fill(dbDS, "t");
                    //获得 EmployeeID->empno
                    string empno;
                    empno = dbDS.Tables[0].Rows[0]["EmpID"].ToString();
                    opinfo.EmpID = empno;
                    //根据EmpNo返回EmployeeName 和 Department
                    selectCMD.Dispose();
                    selectCMD.Connection = conn;
                    selectCMD.CommandText = "SELECT * FROM Employee where EmpID='" + empno + "'";
                    dbDA.SelectCommand = selectCMD;
                    dbDS.Clear();
                    dbDA.Fill(dbDS, "t");
                    opinfo.EmployeeName = dbDS.Tables[0].Rows[0]["name"].ToString();

                    //返回部门名称
                    string depno;
                    depno = dbDS.Tables[0].Rows[0]["depcode"].ToString();
                    selectCMD.Dispose();
                    selectCMD.Connection = conn;
                    selectCMD.CommandText = "SELECT * FROM Department where depcode='" + depno + "'";
                    dbDA.SelectCommand = selectCMD;
                    dbDS.Clear();
                    dbDA.Fill(dbDS, "t");

                    opinfo.Department = dbDS.Tables[0].Rows[0]["deptname"].ToString();

                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
                finally
                {
                    conn.Close();
                }
            }
Пример #20
0
        public void DataSetClearTest()
        {
            var ds = new DataSet();
            DataTable parent = ds.Tables.Add("Parent");
            DataTable child = ds.Tables.Add("Child");

            parent.Columns.Add("id", typeof(int));
            child.Columns.Add("ref_id", typeof(int));

            child.Constraints.Add(new ForeignKeyConstraint("fk_constraint", parent.Columns[0], child.Columns[0]));

            DataRow dr = parent.NewRow();
            dr[0] = 1;
            parent.Rows.Add(dr);
            dr.AcceptChanges();

            dr = child.NewRow();
            dr[0] = 1;
            child.Rows.Add(dr);
            dr.AcceptChanges();

            try
            {
                ds.Clear(); // this should clear all the rows in parent & child tables
            }
            catch (Exception e)
            {
                throw (new Exception("Exception should not have been thrown at Clear method" + e.ToString()));
            }
            Assert.Equal(0, parent.Rows.Count);
            Assert.Equal(0, child.Rows.Count);
        }
Пример #21
0
 private void load_items()
 {
     ds.Clear();
 }
Пример #22
0
 public virtual int FillByDeviceToken(DataSet.APNsDataTable dataTable, string DeviceToken, long TitleId) {
     this.Adapter.SelectCommand = this.CommandCollection[1];
     if ((DeviceToken == null)) {
         throw new global::System.ArgumentNullException("DeviceToken");
     }
     else {
         this.Adapter.SelectCommand.Parameters[0].Value = ((string)(DeviceToken));
     }
     this.Adapter.SelectCommand.Parameters[1].Value = ((long)(TitleId));
     if ((this.ClearBeforeFill == true)) {
         dataTable.Clear();
     }
     int returnValue = this.Adapter.Fill(dataTable);
     return returnValue;
 }
Пример #23
0
        public void Search()
        {
            ds.Clear();


            try
            {
                connectionString = ConfigurationManager.ConnectionStrings["dberp"].ConnectionString;
                sqlConn          = new SqlConnection(connectionString);

                sbSql.Clear();
                sbSqlQuery.Clear();

                if (comboBox1.Text.ToString().Equals("Y"))
                {
                    sbSql.AppendFormat(@" SELECT [NO] AS '編號',CONVERT(NVARCHAR,[DATES],111) AS '日期',[CREATEOR] AS '交付人',[SENDTO] AS '交辨人',[SENDTO2] AS '交辨人2',[MESSAGE] AS '交辨內容',[REPLY] AS '回覆',[STATUS] AS '結案碼',[CREATEORID] AS '交辨ID',[ID] ");
                    sbSql.AppendFormat(@" FROM [TKWORKDELIVERY].[dbo].[WORKDELIVERY] ");
                    sbSql.AppendFormat(@" WHERE CONVERT(NVARCHAR,[DATES],112)>='{0}' AND CONVERT(NVARCHAR,[DATES],112)<='{1}' ", dateTimePicker1.Value.ToString("yyyyMMdd"), dateTimePicker2.Value.ToString("yyyyMMdd"));
                    sbSql.AppendFormat(@" AND [STATUS]='{0}' ", comboBox1.Text.ToString());
                    sbSql.AppendFormat(@" ORDER BY [NO] ");
                    sbSql.AppendFormat(@"  ");
                }
                else
                {
                    sbSql.AppendFormat(@" SELECT [NO] AS '編號',CONVERT(NVARCHAR,[DATES],111) AS '日期',[CREATEOR] AS '交付人',[SENDTO] AS '交辨人',[SENDTO2] AS '交辨人2',[MESSAGE] AS '交辨內容',[REPLY] AS '回覆',[STATUS] AS '結案碼',[CREATEORID] AS '交辨ID',[ID] ");
                    sbSql.AppendFormat(@" FROM [TKWORKDELIVERY].[dbo].[WORKDELIVERY] ");
                    sbSql.AppendFormat(@" WHERE [STATUS]='{0}' ", comboBox1.Text.ToString());
                    sbSql.AppendFormat(@" ORDER BY [NO] ");
                    sbSql.AppendFormat(@"  ");
                }


                adapter = new SqlDataAdapter(@"" + sbSql, sqlConn);

                sqlCmdBuilder = new SqlCommandBuilder(adapter);
                sqlConn.Open();
                ds.Clear();
                adapter.Fill(ds, "TEMPds1");
                sqlConn.Close();


                if (ds.Tables["TEMPds1"].Rows.Count == 0)
                {
                    dataGridView1.DataSource = null;
                }
                else
                {
                    if (ds.Tables["TEMPds1"].Rows.Count >= 1)
                    {
                        dataGridView1.DataSource = ds.Tables["TEMPds1"];
                        dataGridView1.AutoResizeColumns();
                    }
                }
            }
            catch
            {
            }
            finally
            {
            }
        }
Пример #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                decimal userid  = Convert.ToDecimal(Request.QueryString["v"]);
                string  finYear = Request.QueryString["f"];

                //int CurrentYear = DateTime.Today.Year;
                //int PreviousYear = DateTime.Today.Year - 1;
                //int NextYear = DateTime.Today.Year + 1;
                //string PreYear = PreviousYear.ToString();
                //string NexYear = NextYear.ToString();
                //string CurYear = CurrentYear.ToString();
                //string FinYear = null;

                //if (DateTime.Today.Month > 3)
                //{
                //    FinYear = CurYear + "-" + NexYear;
                //}
                //else
                //{
                //    FinYear = PreYear + "-" + CurYear;
                //}

                using (SqlCommand cmd = new SqlCommand())
                {
                    using (SqlDataAdapter adap = new SqlDataAdapter())
                    {
                        using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["LaxNarroConnectionString"].ConnectionString))
                        {
                            //   cmd.CommandText = @"SELECT User_Training_Transaction.Date, User_Training_Transaction.Hours, User_Training_Transaction.Provider, User_Training_Transaction.Financial_Year, User_Training_Transaction.Forwardable,
                            //User_Training_Transaction.Has_been_Forwarded, User_Training_Transaction.Descrption, User_Training_Status.Received_By_Forwarding, User_Training_Status.Units_Done,
                            //User_Training_Status.Min_Required_Category_Units, Activity_Master.Name AS 'Activity Name', Category_Master.Name AS 'Category Name', State_Master.Name AS 'State Name', User_Profile.FirstName,
                            //User_Profile.LastName, User_Profile.OtherName, User_Profile.StreetNumber, User_Profile.StreetName, User_Profile.PostCode, User_Profile.Suburb, User_Profile.LawSocietyNumber, User_Profile.EmailAddress,
                            //User_Profile.PhoneNumber, User_Profile.Address, Country_Master.Name AS 'Country Name', User_Training_Transaction.Your_Role, Activity_Master.ShortName AS 'ActivityShortName', Category_Master.ShortName
                            //FROM User_Training_Transaction INNER JOIN
                            //User_Training_Status ON User_Training_Transaction.Id = User_Training_Status.Training_Transaction_ID AND User_Training_Transaction.User_Id = User_Training_Status.User_Id INNER JOIN
                            //Activity_Master ON User_Training_Transaction.Activity_Id = Activity_Master.ID AND User_Training_Status.Activity_Id = Activity_Master.ID INNER JOIN
                            //Category_Master ON User_Training_Transaction.Category_Id = Category_Master.ID AND User_Training_Status.Category_Id = Category_Master.ID INNER JOIN
                            //State_Master ON User_Training_Transaction.State_Id = State_Master.ID INNER JOIN
                            //User_Profile ON User_Training_Transaction.User_Id = User_Profile.ID AND User_Training_Status.User_Id = User_Profile.ID AND State_Master.ID = User_Profile.StateID AND
                            //State_Master.ID = User_Profile.StateEnrolled INNER JOIN
                            //Country_Master ON State_Master.Country_ID = Country_Master.ID AND User_Profile.CountryID = Country_Master.ID
                            //where User_Training_Transaction.User_Id = " + userid + " and User_Training_Transaction.Financial_Year = '" + FinYear + "'";



                            cmd.CommandText = @"SELECT  User_Training_Transaction.Date, User_Training_Transaction.Hours, User_Training_Transaction.Provider, User_Training_Transaction.Financial_Year, User_Training_Transaction.Forwardable, 
                         User_Training_Transaction.Has_been_Forwarded, User_Training_Transaction.Descrption, User_Training_Status.Received_By_Forwarding, User_Training_Status.Units_Done, 
                         User_Training_Status.Min_Required_Category_Units, User_Profile.FirstName, User_Profile.LastName, User_Profile.OtherName, User_Profile.StreetNumber, User_Profile.StreetName, User_Profile.PostCode, 
                         User_Profile.Suburb, User_Profile.LawSocietyNumber, User_Profile.EmailAddress, User_Profile.PhoneNumber, User_Profile.Address, User_Training_Transaction.Your_Role, Country_Master.Name AS 'Country Name', 
                         State_Master.Name AS  'State Name', State_Master.ShortName , Activity_Master.Name AS 'Activity Name', Activity_Master.ShortName AS 'ActivityShortName', Category_Master.Name  AS 'Category Name', Category_Master.ShortName, 
                         Sub_Activity_Master.Name AS 'SubActivity Name', Sub_Activity_Master.ShortName AS 'SubActivityShortName', User_Training_Transaction.UploadedFileName
                         FROM   User_Training_Transaction INNER JOIN
                         User_Training_Status ON User_Training_Transaction.Id = User_Training_Status.Training_Transaction_ID INNER JOIN
                         User_Profile ON User_Training_Transaction.User_Id = User_Profile.ID AND User_Training_Status.User_Id = User_Profile.ID INNER JOIN
                         Country_Master ON User_Profile.CountryID = Country_Master.ID INNER JOIN
                         State_Master ON User_Profile.StateID = State_Master.ID INNER JOIN
                         Activity_Master ON User_Training_Transaction.Activity_Id = Activity_Master.ID AND User_Training_Status.Activity_Id = Activity_Master.ID INNER JOIN
                         Category_Master ON User_Training_Transaction.Category_Id = Category_Master.ID AND User_Training_Status.Category_Id = Category_Master.ID LEFT OUTER JOIN
                         Sub_Activity_Master ON User_Training_Transaction.SubActivity_Id = Sub_Activity_Master.ID
                         where User_Training_Transaction.User_Id = " + userid + " and User_Training_Transaction.Financial_Year = '" + finYear + "'";


                            cmd.CommandType = CommandType.Text;
                            if (con.State == ConnectionState.Closed)
                            {
                                con.Open();
                            }
                            cmd.Connection     = con;
                            adap.SelectCommand = cmd;
                            data.Clear();
                            adap.Fill(data, "Report_VIC");
                            if (con.State == ConnectionState.Open)
                            {
                                con.Close();
                            }
                        }
                    }
                }

                yearFrom = data.Tables[0].Rows[0][3].ToString().Split('-')[0];
                yearTo   = data.Tables[0].Rows[0][3].ToString().Split('-')[1];
            }
            catch (Exception rr)
            {
                //throw;
            }


            //obj.SetDataSource(data.Tables["Report_ACT"]);
            //obj.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, false, "Report_ACT");
        }
Пример #25
0
 private void ActualizarDatos()
 {
     datos.Clear();
     adaptador.Fill(datos, "peliculas");
 }
Пример #26
0
    public void getLibPrivil()
    {
        try
        {
            string    libcodecollection = "";
            string    coll_Code         = Convert.ToString(ddlCollege.SelectedValue);
            string    sql           = "";
            string    GrpUserVal    = "";
            string    GrpCode       = "";
            string    LibCollection = "";
            Hashtable hsLibcode     = new Hashtable();
            if (singleUser.ToLower() == "true")
            {
                sql = "SELECT DISTINCT lib_code from lib_privileges where user_code=" + userCode + " and lib_code in (select lib_code from library where college_code=" + coll_Code + ")";
                ds.Clear();
                ds = d2.select_method_wo_parameter(sql, "text");
            }
            else
            {
                string[] groupUser = groupUserCode.Split(';');
                if (groupUser.Length > 0)
                {
                    if (groupUser.Length == 1)
                    {
                        sql = "SELECT DISTINCT lib_code from lib_privileges where group_code=" + groupUser[0] + "";
                        ds.Clear();
                        ds = d2.select_method_wo_parameter(sql, "text");
                    }
                    if (groupUser.Length > 1)
                    {
                        for (int i = 0; i < groupUser.Length; i++)
                        {
                            GrpUserVal = groupUser[i];
                            if (!GrpCode.Contains(GrpUserVal))
                            {
                                if (GrpCode == "")
                                {
                                    GrpCode = GrpUserVal;
                                }
                                else
                                {
                                    GrpCode = GrpCode + "','" + GrpUserVal;
                                }
                            }
                        }
                        sql = "SELECT DISTINCT lib_code from lib_privileges where group_code in ('" + GrpCode + "')";
                        ds.Clear();
                        ds = d2.select_method_wo_parameter(sql, "text");
                    }
                }
            }
            if (ds.Tables[0].Rows.Count == 0)
            {
                libcodecollection = "WHERE lib_code IN (-1)";
                goto aa;
            }
            if (ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    string codeCollection = Convert.ToString(ds.Tables[0].Rows[i]["lib_code"]);
                    if (!hsLibcode.Contains(codeCollection))
                    {
                        hsLibcode.Add(codeCollection, "LibCode");
                        if (libcodecollection == "")
                        {
                            libcodecollection = codeCollection;
                        }
                        else
                        {
                            libcodecollection = libcodecollection + "','" + codeCollection;
                        }
                    }
                }
            }
            //libcodecollection = Left(libcodecollection, Len(libcodecollection) - 1);
            libcodecollection = "WHERE lib_code IN ('" + libcodecollection + "')";
aa:
            LibCollection = libcodecollection;
            Library(LibCollection);
        }
        catch (Exception ex)
        {
        }
    }
Пример #27
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     Company.Refresh();
     ds.Clear();
     da.Fill(ds, "vwCompany");
 }
Пример #28
0
        private bool CheckAndCreateMaskedFile(string _FileName, string _MetaFileName)
        {
            bool _return = false;

            Logger.Trace("STARTED: CheckAndCreateMaskedFile Method.");
            try
            {
                FileProcessingModel _fileProcessingModel = null;
                bool IsProcessed = false;
                try
                {
                    FileExtn _fileExt = new FileExtn();

                    FileExtnType _fileExtTyp = new FileExtnType();
                    if (_FileName.ToUpper().Trim().Contains(Nbs_East))
                    {
                        _fileExt = FileExtn.TXT;
                    }

                    else
                    {
                        _fileExt = (FileExtn)Enum.Parse(typeof(FileExtn), FileIOService.GetFileExtension(_FileName).Split('.')[1].ToUpper());
                    }

                    if (_fileExt.ToString().ToUpper() == Convert.ToString(FileExtn.TXT))
                    {
                        _fileExtTyp = (FileExtnType)GetFileExtensionAndTypeDictionary()
                                      .FirstOrDefault(x => x.Key == Convert.ToString(_fileExt)).Value.Key;
                    }
                    _fileProcessingModel = new FileProcessingModel
                    {
                        InputFileName                  = FileIOService.GetFileName(_FileName),
                        InputFileNameExtension         = FileIOService.GetFileExtension(_FileName),
                        InputFileStream                = FileIOService.GetFileStream(_FileName),
                        InputMetadataFileName          = FileIOService.GetFileName(_MetaFileName),
                        InputMetadataFileNameExtension = FileIOService.GetFileExtension(_MetaFileName),
                        InputMetaDataFileStream        = FileIOService.GetFileStream(_MetaFileName),
                        FileExtensionType              = _fileExtTyp,
                        FileExtension                  = _fileExt
                    };
                    IsProcessed = true;
                    Logger.Trace(string.Format("STARTED: Processing of file: {0}", _FileName));
                }
                catch (Exception e) { IsProcessed = false; }

                if (IsProcessed)
                {
                    //DataMasking *****Started****
                    Logger.Trace("STARTED: DataMasking Process");
                    DataSet dsMaskingSource = new DataSet();
                    dsMaskingSource.Clear();
                    dsMaskingSource = FileIOService.GetMaskingSourceDataSet();

                    FileProcessingModel model = DataMaskingService.DataMaskingFileProcessing(dsMaskingSource, _FileName, _MetaFileName, _fileProcessingModel);
                    _fileProcessingModel.HasOutputFileDetails = (model == null ? false : model.HasOutputFileDetails);
                    _fileProcessingModel.HasOutputErrors      = (model == null ? true : model.HasOutputErrors);

                    Logger.Trace("ENDED: DataMasking Process");
                    //DataMasking *****Ended****

                    if (!_fileProcessingModel.HasOutputErrors && _fileProcessingModel.HasOutputFileDetails)
                    {
                        _fileProcessingModel.OutputFileName                  = "Masked_" + _fileProcessingModel.InputFileName;
                        _fileProcessingModel.OutputFileNameExtension         = _fileProcessingModel.InputFileNameExtension;
                        _fileProcessingModel.OutputMetadataFileName          = "Masked_" + _fileProcessingModel.InputMetadataFileName;
                        _fileProcessingModel.OutputMetadataFileNameExtension = _fileProcessingModel.InputMetadataFileNameExtension;

                        string outputFileName         = ConfigHelper.Model.OutputFilePathLocation_Local + Path.DirectorySeparatorChar + _fileProcessingModel.OutputFileName + _fileProcessingModel.OutputFileNameExtension;
                        string outputMetadataFileName = ConfigHelper.Model.OutputFilePathLocation_Local + Path.DirectorySeparatorChar + _fileProcessingModel.OutputMetadataFileName + _fileProcessingModel.OutputMetadataFileNameExtension;

                        bool retOutputFile     = FileIOService.CreateFileFromFileStream(outputFileName, _fileProcessingModel.OutputDataFileBytes);
                        bool retOutputMetaFile = FileIOService.CopyFile(_MetaFileName, outputMetadataFileName);


                        Logger.Trace(string.Format("ENDED: Processing of file: {0}", _FileName));

                        if (retOutputFile && retOutputMetaFile)
                        {
                            _ = RemoveInputFiles(_FileName, _MetaFileName);

                            Logger.Trace(string.Format("SUCCESS: Output file generated successfully - {0}", outputFileName));
                            _return = true;
                        }
                        else
                        {
                            Logger.Trace("DISCARDED: Output Error");
                            _return = false;
                            _       = MoveFilesToOutputDiscarded(_FileName, _MetaFileName);
                        }
                    }
                    else
                    {
                        Logger.Trace("DISCARDED: Output Error");
                        _return = false;
                        _       = MoveFilesToOutputDiscarded(_FileName, _MetaFileName);
                    }
                }
                else
                {
                    Logger.Trace("DISCARDED: INPUT Error");
                    _return = false;
                    _       = MoveFilesToInputDiscarded(_FileName, _MetaFileName);
                }
            }
            catch (Exception ex)
            {
                _return = false;
                Logger.Error(ex, "CheckAndCreateMaskedFile");
                Logger.Trace("DISCARDED: Output Error");
                _ = MoveFilesToOutputDiscarded(_FileName, _MetaFileName);
            }
            Logger.Trace("ENDED: CheckAndCreateMaskedFile Method");
            return(_return);
        }
Пример #29
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            String eqid       = TextBox1.Text;
            String eqname     = TextBox2.Text;
            String eqstandard = TextBox3.Text;
            String eqphoto    = TextBox4.Text;
            String eqprice    = TextBox5.Text;
            String eqdate     = TextBox6.Text;
            String eqlocation = TextBox7.Text;
            String eqmanage   = TextBox8.Text;
            String emid       = TextBox9.Text;
            String sqlconn    =
                "Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename='|DataDirectory|\\Database1.mdf';";
            SqlConnection myConnection = new SqlConnection(sqlconn);

            //打开数据库连接
            myConnection.Open();
            //设置SelectCommand
            SqlCommand myCommand = new SqlCommand("select * from Equipment", myConnection);
            //设置InsertCommand
            SqlCommand sqlInsertCommand1 = new SqlCommand();

            sqlInsertCommand1.Connection = myConnection;

            sqlInsertCommand1.CommandText = @"INSERT INTO Equipment(eqid,eqname,eqstandard,eqphoto,eqprice,eqdate,eqlocation,eqmanage,emid) 
                                         VALUES (@eqid,@eqname,@eqstandard,@eqphoto,@eqprice,@eqdate,@eqlocation,@eqmanage,@emid); ";
            sqlInsertCommand1.Parameters.Add(new SqlParameter("@eqid", SqlDbType.NChar, 15, "eqid"));
            sqlInsertCommand1.Parameters.Add(new SqlParameter("@eqname", SqlDbType.NChar, 15, "eqname"));
            sqlInsertCommand1.Parameters.Add(new SqlParameter("@eqstandard", SqlDbType.NChar, 15, "eqstandard"));
            sqlInsertCommand1.Parameters.Add(new SqlParameter("@eqphoto", SqlDbType.NChar, 15, "eqphoto"));
            sqlInsertCommand1.Parameters.Add(new SqlParameter("@eqprice", SqlDbType.NChar, 15, "eqprice"));
            sqlInsertCommand1.Parameters.Add(new SqlParameter("@eqdate", SqlDbType.NChar, 10, "eqdate"));
            sqlInsertCommand1.Parameters.Add(new SqlParameter("@eqlocation", SqlDbType.NChar, 15, "eqlocation"));
            sqlInsertCommand1.Parameters.Add(new SqlParameter("@eqmanage", SqlDbType.NChar, 15, "eqmanage"));
            sqlInsertCommand1.Parameters.Add(new SqlParameter("@emid", SqlDbType.NChar, 10, "emid"));
            SqlDataAdapter Adapter = new SqlDataAdapter();

            Adapter.SelectCommand = myCommand;
            Adapter.InsertCommand = sqlInsertCommand1;
            //填充至数据集
            DataSet myDs = new DataSet();

            Adapter.Fill(myDs);
            //获取DataTable
            DataTable myTable = myDs.Tables[0];
            //插入1笔数据,第2次运行时要改一下编号,免主键重复
            DataRow myRow = myTable.NewRow();

            //为新行赋值
            myRow["eqid"]       = eqid;
            myRow["eqname"]     = eqname;
            myRow["eqstandard"] = eqstandard;
            myRow["eqphoto"]    = eqphoto;
            myRow["eqprice"]    = eqprice;
            myRow["eqdate"]     = eqdate;
            myRow["eqlocation"] = eqlocation;
            myRow["eqmanage"]   = eqmanage;
            myRow["emid"]       = emid;
            //添加到Rows集合中
            myTable.Rows.Add(myRow);
            //提交数据到数据库
            Adapter.Update(myDs);
            //关闭数据库
            myDs.Clear();
            myConnection.Close();
            //以上完成数据插入
            Response.Redirect("Eq_other.aspx");
        }
Пример #30
0
        private void CrystalReportViewer1_ReportRefresh(object source, ViewerEventArgs e)
        {
            DataSet dataSet = new DataSet();

            this.cmbSalir.Enabled = false;
            this.Informe.Close();
            try
            {
                FormulaFieldDefinition definition2;
                bool   flag = false;
                string selectConnectionString = "data source=" + Variables.gServer + ";user id=scala;password=scala;initial catalog=scalaDB;persist security info=False;packet size=4096";
                dataSet.Clear();
                this.DS1.Clear();
                string selectCommandText = "SELECT OR01001,OR01004,OR01014,OR01016,OR01050,OR01072 from OR010100 where OR01002<>6";
                if ((StringType.StrCmp(Variables.gAlmacen1, "", false) != 0) & (StringType.StrCmp(Variables.gAlmacen2, "", false) != 0))
                {
                    selectCommandText = selectCommandText + " and (OR01050='" + Variables.gAlmacen1 + "' or OR01050='" + Variables.gAlmacen2 + "')";
                }
                else if (StringType.StrCmp(Variables.gAlmacen1, "", false) != 0)
                {
                    selectCommandText = selectCommandText + " and OR01050='" + Variables.gAlmacen1 + "'";
                }
                else if (StringType.StrCmp(Variables.gAlmacen2, "", false) != 0)
                {
                    selectCommandText = selectCommandText + " and OR01050='" + Variables.gAlmacen2 + "'";
                }
                if (StringType.StrCmp(Variables.gCodCli, "", false) != 0)
                {
                    selectCommandText = selectCommandText + " and OR01004='" + Variables.gCodCli + "'";
                }
                else
                {
                    selectCommandText = selectCommandText + " and ((OR01004>='600000' and OR01004<='699000') or OR01004='00WARREXPO')";
                }
                this.AdapOR01     = new SqlDataAdapter(selectCommandText, selectConnectionString);
                selectCommandText = "SELECT OR03001,OR03005,OR03006,OR03007,OR03011,OR03012,OR03019,OR03067,OR03068 FROM dbo.OR030100 where OR03011-OR03012<>0";
                this.AdapOR03     = new SqlDataAdapter(selectCommandText, selectConnectionString);
                if (Variables.gOVaListar == 1)
                {
                    selectCommandText = "SELECT SL01001,SL01002 from SL010100";
                }
                else if (Variables.gOVaListar == 2)
                {
                    selectCommandText = "SELECT SL01001,SL01002 from SL010100 where SL01060='1'";
                }
                else if (Variables.gOVaListar == 3)
                {
                    selectCommandText = "SELECT SL01001,SL01002 from SL010100 where SL01075='1'";
                }
                this.AdapSL01     = new SqlDataAdapter(selectCommandText, selectConnectionString);
                selectCommandText = "SELECT SC23001,SC23002 FROM dbo.SC230100";
                this.AdapSC23     = new SqlDataAdapter(selectCommandText, selectConnectionString);
                selectCommandText = "SELECT PC03001,PC03002,PC03029 FROM dbo.PC030100";
                this.AdapPC03     = new SqlDataAdapter(selectCommandText, selectConnectionString);
                this.AdapOR01.Fill(dataSet, "OR010100");
                this.AdapOR03.Fill(dataSet, "OR030100");
                this.AdapSL01.Fill(dataSet, "SL010100");
                this.AdapSC23.Fill(dataSet, "SC230100");
                this.AdapPC03.Fill(dataSet, "PC030100");
                selectCommandText = "SELECT PL23003,PL23004 FROM dbo.PL230100 where PL23001='2' and PL23002='00'";
                this.AdapPL23     = new SqlDataAdapter(selectCommandText, selectConnectionString);
                this.AdapPL23.Fill(this.DS1, "PL230100");
                string        connectionString = "data source=" + Variables.gServer + ";user id=teleprinter;password=tele;initial catalog=Colector;persist security info=False;packet size=4096";
                SqlConnection connection       = new SqlConnection(connectionString);
                connection.Open();
                flag = true;
                SqlCommand command = new SqlCommand("delete " + Variables.gTermi + "TmpFormaDesp", connection);
                int        num2    = command.ExecuteNonQuery();
                long       num3    = this.DS1.Tables["PL230100"].Rows.Count - 1;
                for (long i = 0L; i <= num3; i += 1L)
                {
                    DataRow row = this.DS1.Tables["PL230100"].Rows[(int)i];
                    command = new SqlCommand(StringType.FromObject(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj(ObjectType.StrCatObj("insert into " + Variables.gTermi + "TmpFormaDesp (Codigo,Descripcion) values (", row["PL23003"]), ",'"), row["PL23004"]), "')")), connection);
                    try
                    {
                        command.ExecuteNonQuery();
                    }
                    catch (Exception exception1)
                    {
                        ProjectData.SetProjectError(exception1);
                        Exception exception = exception1;
                        Interaction.MsgBox("Se ha producido el siguiente error:" + exception.Message, MsgBoxStyle.OKOnly, null);
                        if (flag)
                        {
                            connection.Close();
                            flag = false;
                        }
                        ProjectData.ClearProjectError();
                        return;

                        ProjectData.ClearProjectError();
                    }
                }
                connection.Close();
                flag = false;
                new SqlDataAdapter("select * from " + Variables.gTermi + "TmpFormaDesp as PC1TmpFormaDesp", connectionString).Fill(dataSet, "PC1TmpFormaDesp");
                if (Variables.gOrdenList == 1)
                {
                    this.Informe.Load(Application.StartupPath + @"\repovexp1.rpt");
                }
                else if (Variables.gOrdenList == 2)
                {
                    this.Informe.Load(Application.StartupPath + @"\repovexp2.rpt");
                }
                this.Informe.SetDataSource(dataSet);
                FormulaFieldDefinitions formulaFields = this.Informe.DataDefinition.FormulaFields;
                FormulaFieldDefinition  definition    = formulaFields["tipo"];
                definition.Text = "'" + Variables.gTipoList + "'";
                if (Variables.gOrdenList == 1)
                {
                    definition2      = formulaFields["orden"];
                    definition2.Text = "'Ordenado por Orden de Compra Cliente'";
                }
                else if (Variables.gOrdenList == 2)
                {
                    definition2      = formulaFields["orden"];
                    definition2.Text = "'Ordenado por Fecha Confirmada'";
                }
                this.CrystalReportViewer1.ReportSource = this.Informe;
                this.CrystalReportViewer1.Refresh();
                this.cmbSalir.Enabled = true;
            }
            catch (Exception exception3)
            {
                ProjectData.SetProjectError(exception3);
                Exception exception2 = exception3;
                Interaction.MsgBox("Se ha producido el siguiente error:" + exception2.Message, MsgBoxStyle.OKOnly, null);
                ProjectData.ClearProjectError();
            }
        }
Пример #31
0
        public void SERACHCOP()
        {
            SqlDataAdapter    adapter1       = new SqlDataAdapter();
            SqlCommandBuilder sqlCmdBuilder1 = new SqlCommandBuilder();
            DataSet           ds             = new DataSet();


            ds.Clear();

            if (string.IsNullOrEmpty(textBox3.Text))
            {
                try
                {
                    //20210902密
                    Class1 TKID = new Class1();//用new 建立類別實體
                    SqlConnectionStringBuilder sqlsb = new SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["dbconn"].ConnectionString);

                    //資料庫使用者密碼解密
                    sqlsb.Password = TKID.Decryption(sqlsb.Password);
                    sqlsb.UserID   = TKID.Decryption(sqlsb.UserID);

                    String connectionString;
                    sqlConn = new SqlConnection(sqlsb.ConnectionString);


                    sbSql.Clear();
                    sbSqlQuery.Clear();


                    sbSql.AppendFormat(@"
                                    SELECT CONVERT(INT,SUM(MONEYS)) MONEYS
                                    FROM(
                                    SELECT SUM(TH037) AS 'MONEYS'
                                    FROM[TK].dbo.COPTG,[TK].dbo.COPTH
                                    WHERE TG001 = TH001 AND TG002 = TH002
                                    AND  SUBSTRING(TG003, 1, 6) = '{0}'
                                    UNION ALL
                                    SELECT SUM(TB031) AS 'MONEYS'
                                    FROM[TK].dbo.POSTB
                                    WHERE  SUBSTRING(TB001, 1, 6) = '{0}'
                                    ) AS TEMP"
                                       , dateTimePicker4.Value.ToString("yyyyMM"));

                    adapter1 = new SqlDataAdapter(@"" + sbSql, sqlConn);

                    sqlCmdBuilder1 = new SqlCommandBuilder(adapter1);
                    sqlConn.Open();
                    ds.Clear();
                    adapter1.Fill(ds, "TEMPds1");
                    sqlConn.Close();


                    if (ds.Tables["TEMPds1"].Rows.Count == 0)
                    {
                    }
                    else
                    {
                        if (ds.Tables["TEMPds1"].Rows.Count >= 1)
                        {
                            textBox3.Text = ds.Tables["TEMPds1"].Rows[0]["MONEYS"].ToString();
                        }
                    }
                }
                catch
                {
                }
                finally
                {
                }
            }
            else
            {
            }
        }
Пример #32
0
        private void butIn_Click(object sender, System.EventArgs e)
        {
            /*
             * xxx.bhytkb a,xxx.bhytthuoc b,xxx.bhytds c,"+user+".d_dmbd d,"+user+".d_dmnhom e,"+user+".v_nhomvp f,"+user+".btdkp_bv h,"+user+".v_nhombhyt i
             *
             * a.id=b.id and a.mabn=c.mabn and b.mabd=d.id and d.manhom=e.id and e.nhomvp=f.ma and a.makp=h.makp(+) and f.idnhombhyt=i.id
             * */
            Cursor = Cursors.WaitCursor;
            ds.Clear();
            dsts.Clear();
            sql  = "select a.id,a.mabn,c.hoten,a.sothe,h.tenkp,a.chandoan,a.maicd,";
            sql += "to_char(a.ngay,'dd/mm/yy') as ngayra,to_char(a.ngay,'dd/mm/yy') as ngayvao,";
            sql += "" + m.for_num_ngay("a.ngay") + "-" + m.for_num_ngay("a.ngay") + "+1 as songay,";
            sql += "i.stt,b.soluong*j.giamua as sotien,a.congkham";
            sql += " from xxx.bhytkb a inner join xxx.bhytthuoc b on a.id=b.id inner join xxx.bhytds c on a.mabn=c.mabn inner join " + user + ".d_dmbd d on b.mabd=d.id inner join " + user + ".d_dmnhom e on d.manhom=e.id inner join " + user + ".v_nhomvp f on e.nhomvp=f.ma left join " + user + ".btdkp_bv h on a.makp=h.makp inner join " + user + ".v_nhombhyt i on f.idnhombhyt=i.id inner join xxx.d_theodoi j on b.sttt=j.id ";
            sql += " where ";
            sql += " a.maphu=" + int.Parse(madoituong.SelectedValue.ToString());
            sql += " and " + m.for_ngay("a.ngay", "'dd/mm/yyyy'") + " between to_date('" + tu.Text + "','dd/mm/yyyy') and to_date('" + den.Text + "','dd/mm/yyyy')";
            if (sothe.Text != "")
            {
                sql += " and substr(a.sothe," + Convert.ToInt16(vitri.Value) + "," + sothe.Text.Trim().Length + ")='" + sothe.Text.Trim() + "'";
            }
            sql += " and a.sothe is not null";
            if (s_tunguyen != "" && loaidt.SelectedIndex != 0)
            {
                if (loaidt.SelectedIndex == 1)
                {
                    sql += " and substr(a.sothe," + v1 + "," + v2 + ") not in ('" + s_tunguyen.Substring(0, s_tunguyen.Length) + "')";
                }
                else if (loaidt.SelectedIndex == 2)
                {
                    sql += " and substr(a.sothe," + v1 + "," + v2 + ") in ('" + s_tunguyen.Substring(0, s_tunguyen.Length) + "')";
                }
            }

            /*
             * xxx.bhytkb a,xxx.bhytcls b,xxx.bhytds c,"+user+".v_giavp d,"+user+".v_loaivp e,"+user+".v_nhomvp f,"+user+".btdkp_bv h,"+user+".v_nhombhyt i
             *
             * a.id=b.id and a.mabn=c.mabn and b.mavp=d.id and d.id_loai=e.id and e.id_nhom=f.ma and a.makp=h.makp(+) and f.idnhombhyt=i.id
             * */
            sql += " union all ";
            sql += "select a.id,a.mabn,c.hoten,a.sothe,h.tenkp,a.chandoan,a.maicd,";
            sql += "to_char(a.ngay,'dd/mm/yy') as ngayra,to_char(a.ngay,'dd/mm/yy') as ngayvao,";
            sql += "" + m.for_num_ngay("a.ngay") + "-" + m.for_num_ngay("a.ngay") + "+1 as songay,";
            sql += "i.stt,b.soluong*b.dongia as sotien,a.congkham";
            sql += " from xxx.bhytkb a inner join xxx.bhytcls b on a.id=b.id inner join xxx.bhytds c on a.mabn=c.mabn inner join " + user + ".v_giavp d on b.mavp=d.id inner join " + user + ".v_loaivp e on d.id_loai=e.id inner join " + user + ".v_nhomvp f on e.id_nhom=f.ma left join " + user + ".btdkp_bv h on a.makp=h.makp inner join " + user + ".v_nhombhyt i on f.idnhombhyt=i.id ";
            sql += " where ";
            sql += " a.maphu=" + int.Parse(madoituong.SelectedValue.ToString());
            sql += " and " + m.for_ngay("a.ngay", "'dd/mm/yyyy'") + " between to_date('" + tu.Text + "','dd/mm/yyyy') and to_date('" + den.Text + "','dd/mm/yyyy')";
            if (sothe.Text != "")
            {
                sql += " and substr(a.sothe," + Convert.ToInt16(vitri.Value) + "," + sothe.Text.Trim().Length + ")='" + sothe.Text.Trim() + "'";
            }
            sql += " and a.sothe is not null";
            if (s_tunguyen != "" && loaidt.SelectedIndex != 0)
            {
                if (loaidt.SelectedIndex == 1)
                {
                    sql += " and substr(a.sothe," + v1 + "," + v2 + ") not in ('" + s_tunguyen.Substring(0, s_tunguyen.Length) + "')";
                }
                else if (loaidt.SelectedIndex == 2)
                {
                    sql += " and substr(a.sothe," + v1 + "," + v2 + ") in ('" + s_tunguyen.Substring(0, s_tunguyen.Length) + "')";
                }
            }

            System.Data.DataTable tmp = d.get_thuoc(tu.Text, den.Text, sql).Tables[0];
            foreach (DataRow r in tmp.Rows)
            {
                r1 = d.getrowbyid(dsts.Tables[0], "id=" + decimal.Parse(r["id"].ToString()));
                if (r1 == null)
                {
                    r2          = dsts.Tables[0].NewRow();
                    r2["id"]    = r["id"].ToString();
                    r2["sothe"] = r["sothe"].ToString();
                    dsts.Tables[0].Rows.Add(r2);
                }
                sql = "sothe='" + r["sothe"].ToString().Trim() + "'";
                r1  = d.getrowbyid(ds.Tables[0], sql);
                if (r1 == null)
                {
                    r2       = ds.Tables[0].NewRow();
                    r2["id"] = r["id"].ToString();
                    if (r["sothe"].ToString().Trim().Length > 6)
                    {
                        r2["stt"]      = (r["sothe"].ToString().Substring(2, 2) == s_thetrongtinh)?0:1;
                        r2["tinh"]     = (r["sothe"].ToString().Substring(2, 2) == s_thetrongtinh)?"TỈNH":"KHÁC TỈNH";
                        r2["sothe1"]   = (s_thetunguyen.IndexOf(r["sothe"].ToString().Substring(4, 2)) == -1)?"0":"1";
                        r2["doituong"] = (s_thetunguyen.IndexOf(r["sothe"].ToString().Substring(4, 2)) == -1)?"BẮT BUỘC":"TỰ NGUYỆN";
                        r2["sothe2"]   = r["sothe"].ToString().Substring(2, 2);
                        r2["sothe3"]   = r["sothe"].ToString().Substring(4, 2);
                    }
                    r2["sothe"]    = r["sothe"].ToString().Trim();
                    r2["mabn"]     = r["mabn"].ToString();
                    r2["hoten"]    = r["hoten"].ToString();
                    r2["tenkp"]    = r["tenkp"].ToString();
                    r2["chandoan"] = r["chandoan"].ToString();
                    r2["maicd"]    = r["maicd"].ToString();
                    r2["ngayvao"]  = r["ngayvao"].ToString();
                    r2["ngayra"]   = r["ngayra"].ToString();
                    r2["songay"]   = r["songay"].ToString();
                    foreach (DataRow r3 in dtnhom.Select("true", "stt"))
                    {
                        r2["c" + r3["stt"].ToString().Trim()] = 0;
                    }
                    r2["congkham"] = r["congkham"].ToString();
                    r2["c" + r["stt"].ToString().Trim()] = r["sotien"].ToString();
                    r2["tc"] = decimal.Parse(r["sotien"].ToString()) + decimal.Parse(r["congkham"].ToString());
                    ds.Tables[0].Rows.Add(r2);
                }
                else
                {
                    dr = ds.Tables[0].Select(sql);
                    if (dr.Length > 0)
                    {
                        dr[0]["c" + r["stt"].ToString().Trim()] = decimal.Parse(dr[0]["c" + r["stt"].ToString().Trim()].ToString()) + decimal.Parse(r["sotien"].ToString());
                        dr[0]["tc"] = decimal.Parse(dr[0]["tc"].ToString()) + decimal.Parse(r["sotien"].ToString());
                    }
                }
            }
            foreach (DataRow r in ds.Tables[0].Rows)
            {
                r["soluot"] = dsts.Tables[0].Select("sothe='" + r["sothe"].ToString() + "'").Length;
                r["songay"] = dsts.Tables[0].Select("sothe='" + r["sothe"].ToString() + "'").Length;
            }
            dsxml = new DataSet();
            dsxml = ds.Copy();
            dsxml.Clear();
            dsxml.Merge(ds.Tables[0].Select("true", "stt,sothe1,sothe3,sothe2,sothe,ngayvao,mabn"));
            dsxml.WriteXml("..//..//..//xml//t_thkcbbhyt.xml", XmlWriteMode.WriteSchema);
            Cursor = Cursors.Default;
            if (dsxml.Tables[0].Rows.Count == 0)
            {
                MessageBox.Show(lan.Change_language_MessageText("Không có số liệu !"), LibMedi.AccessData.Msg);
            }
            else
            {
                dllReportM.frmReport f = new dllReportM.frmReport(m, dsxml.Tables[0], "rptthkcbbhytngtr.rpt", (tu.Text == den.Text)?"Ngày " + tu.Text:"Từ ngày " + tu.Text + " đến " + den.Text, madoituong.Text, loaidt.Text, "", "", "", "", "", "", "");
                f.ShowDialog();
            }
        }
Пример #33
0
        public void SERACHCOPPURPCTPTOADDORUPDATE()
        {
            SqlDataAdapter    adapter1       = new SqlDataAdapter();
            SqlCommandBuilder sqlCmdBuilder1 = new SqlCommandBuilder();
            DataSet           ds             = new DataSet();


            ds.Clear();

            try
            {
                //20210902密
                Class1 TKID = new Class1();//用new 建立類別實體
                SqlConnectionStringBuilder sqlsb = new SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["dbconn"].ConnectionString);

                //資料庫使用者密碼解密
                sqlsb.Password = TKID.Decryption(sqlsb.Password);
                sqlsb.UserID   = TKID.Decryption(sqlsb.UserID);

                String connectionString;
                sqlConn = new SqlConnection(sqlsb.ConnectionString);


                sbSql.Clear();
                sbSqlQuery.Clear();


                sbSql.AppendFormat(@"
                                    SELECT *
                                    FROM [TKPUR].[dbo].[COPPURPCT]
                                    WHERE [YM]='{0}'
                                    ", dateTimePicker4.Value.ToString("yyyyMM"));

                adapter1 = new SqlDataAdapter(@"" + sbSql, sqlConn);

                sqlCmdBuilder1 = new SqlCommandBuilder(adapter1);
                sqlConn.Open();
                ds.Clear();
                adapter1.Fill(ds, "TEMPds1");
                sqlConn.Close();


                if (ds.Tables["TEMPds1"].Rows.Count == 0)
                {
                    ADDCOPPURPCT(dateTimePicker4.Value.ToString("yyyyMM"), textBox1.Text.Trim(), textBox2.Text.Trim(), textBox3.Text.Trim());
                }
                else
                {
                    if (ds.Tables["TEMPds1"].Rows.Count >= 1)
                    {
                        UPDATECOPPURPCT(dateTimePicker4.Value.ToString("yyyyMM"), textBox1.Text.Trim(), textBox2.Text.Trim(), textBox3.Text.Trim());
                    }
                }
            }
            catch
            {
            }
            finally
            {
            }
        }
Пример #34
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["username"] == null)
        {
            Response.Write("<script>alert('用户登录超时,请重新登录。');location='../Default.aspx'</script>");
            return;
        }
        //取值操作和判定开关

        DB      db   = new DB();
        String  time = "select * from time where period='任务书'";
        DataSet ds   = db.Select(time, db.DBconn());

        try
        {
            DateTime period_star1 = Convert.ToDateTime(ds.Tables[0].Rows[0][2].ToString().Trim()); //开始时间
            DateTime period_end1  = Convert.ToDateTime(ds.Tables[0].Rows[0][3].ToString().Trim()); //结束时间
            String   flg          = ds.Tables[0].Rows[0][5].ToString().Trim();;                    //结束时间
            DateTime now          = DateTime.Today;
            if (flg == "开" && (now >= period_star1) && (now <= period_end1))
            {
            }
            else
            {
                Response.Write("<script>alert('对不起,该功能暂未开放。请关注系统公告。');location='Default.aspx'</script>");
            }
        }
        catch
        {
            Response.Write("<script>alert('数据库时间设定取出过程错误,可能还未设定时间。');location='Default.aspx'</script>");
        }
        finally
        {
            ds.Clear();
        }

        //查找是否存在于表中如果存在则相当已修改,不存在为插入
        String sel = "select * from studentTask where student_ID='" + Session["username"] + "'";

        ds = db.Select(sel, db.DBconn());
        if (ds.Tables[0].Rows.Count > 0)
        {//如果读取到数据变成了修改 并装载数据
            this.Panel1.GroupingText = "学生任务书修改";
            Button1.Text             = "修改";

            Label1.Text = ds.Tables[0].Rows[0][1].ToString().Trim();
            Label2.Text = ds.Tables[0].Rows[0][2].ToString().Trim();
            Label3.Text = ds.Tables[0].Rows[0][3].ToString().Trim();
            Label4.Text = ds.Tables[0].Rows[0][4].ToString().Trim();
            Label5.Text = ds.Tables[0].Rows[0][5].ToString().Trim();
            Label6.Text = ds.Tables[0].Rows[0][6].ToString().Trim();
            Label7.Text = ds.Tables[0].Rows[0][7].ToString().Trim();
            Label8.Text = ds.Tables[0].Rows[0][8].ToString().Trim();
            Label9.Text = ds.Tables[0].Rows[0][9].ToString().Trim();
            RadioButtonList1.SelectedValue = ds.Tables[0].Rows[0][10].ToString().Trim();
            Label10.Text = ds.Tables[0].Rows[0][11].ToString().Trim();
            Label11.Text = ds.Tables[0].Rows[0][12].ToString().Trim();
            Label12.Text = ds.Tables[0].Rows[0][13].ToString().Trim();

            if (this.TextBox1.Text == "")
            {
                this.TextBox1.Text = ds.Tables[0].Rows[0][14].ToString().Trim();
            }
            if (this.TextBox2.Text == "")
            {
                this.TextBox2.Text = ds.Tables[0].Rows[0][15].ToString().Trim();
            }
            if (this.TextBox3.Text == "")
            {
                this.TextBox3.Text = ds.Tables[0].Rows[0][16].ToString().Trim();
            }
            if (this.TextBox4.Text == "")
            {
                this.TextBox4.Text = ds.Tables[0].Rows[0][17].ToString().Trim();
            }
            ds.Clear();
            string adv = "select * from StoTContent where student_ID='" + Session["username"] + "' and topic='学生任务书' and state='是'";
            ds = db.Select(adv, db.DBconn());
            int adv1 = ds.Tables[0].Rows.Count;
            if (adv1 > 0)
            {
                this.Button1.Enabled   = false;
                this.Label13.Text      = "您的学生任务书已经被您的导师通过,无法修改";
                this.TextBox1.ReadOnly = true;
                this.TextBox2.ReadOnly = true;
                this.TextBox3.ReadOnly = true;
                this.TextBox4.ReadOnly = true;
            }
        }
        else//不是则插入数据
        {
            this.Panel1.GroupingText = "学生任务书填写";
            Button1.Text             = "提交";
            //获取学生信息
            String stu = "select * from student where student_ID='" + Session["username"] + "'";
            ds = db.Select(stu, db.DBconn());
            String Depart  = "";
            String specify = "";
            String class1  = "";
            try
            {
                Depart  = ds.Tables[0].Rows[0][12].ToString().Trim();
                specify = ds.Tables[0].Rows[0][10].ToString().Trim();
                class1  = ds.Tables[0].Rows[0][13].ToString().Trim();
            }
            catch
            {
                Response.Write("<script>alert('数据库学生信息错误,可能还未导入学生数据。');location='Default.aspx'</script>");
            }
            finally
            {
                ds.Clear();
            }

            //由学生查找导师和论文信息
            String stu_paper = "select * from select_Result where student_ID='" + Session["username"] + "'";
            ds = db.Select(stu_paper, db.DBconn());
            String teacher_ID   = "";
            String teacher_Name = "";
            String title        = "";
            string paperid      = "";
            try
            {
                teacher_ID            = ds.Tables[0].Rows[0][4].ToString().Trim();
                paperid               = ds.Tables[0].Rows[0][8].ToString().Trim();
                teacher_Name          = ds.Tables[0].Rows[0][5].ToString().Trim();
                title                 = ds.Tables[0].Rows[0][6].ToString().Trim();
                Session["teacher_ID"] = teacher_ID;
            }
            catch
            {
                Response.Write("<script>alert('数据库选题结果表错误,您的课题选择结果可能还未入库。');location='Default.aspx'</script>");
            }
            finally
            {
                ds.Clear();
            }

            //论文信息获取
            String paper = "select * from paperApply where id='" + paperid + "'";
            ds = db.Select(paper, db.DBconn());
            String preriod           = "";
            String kind              = "";
            String project_Name      = "";
            String project_Depart    = "";
            String project_Num       = "";
            String target            = "";
            String aim_Meaning       = "";
            String current_situation = "";
            String content           = "";
            String reference         = "";
            String remark            = "";
            try
            {
                preriod           = ds.Tables[0].Rows[0][2].ToString().Trim();
                kind              = ds.Tables[0].Rows[0][4].ToString().Trim();
                project_Name      = ds.Tables[0].Rows[0][5].ToString().Trim();
                project_Depart    = ds.Tables[0].Rows[0][6].ToString().Trim();
                project_Num       = ds.Tables[0].Rows[0][7].ToString().Trim();
                target            = ds.Tables[0].Rows[0][8].ToString().Trim();
                aim_Meaning       = ds.Tables[0].Rows[0][9].ToString().Trim();
                current_situation = ds.Tables[0].Rows[0][10].ToString().Trim();
                content           = ds.Tables[0].Rows[0][11].ToString().Trim();
                reference         = ds.Tables[0].Rows[0][12].ToString().Trim();
                remark            = ds.Tables[0].Rows[0][13].ToString().Trim();
            }
            catch
            {
                Response.Write("<script>alert('数据库论文信息错误。');location='Default.aspx'</script>");
            }
            finally
            {
                ds.Clear();
            }

            //时间获取
            String time1 = "select * from time where period='提交论文时间'";
            ds = db.Select(time1, db.DBconn());
            DateTime period_star = DateTime.Today;   //开始时间
            DateTime period_end  = DateTime.Today;
            DateTime now         = DateTime.Today;
            try
            {
                period_star = Convert.ToDateTime(ds.Tables[0].Rows[0][2].ToString().Trim()); //开始时间
                period_end  = Convert.ToDateTime(ds.Tables[0].Rows[0][3].ToString().Trim()); //结束时间
            }
            catch
            {
                Response.Write("<script>alert('数据库时间设定错误,管理员可能还未设定时间。');location='Default.aspx'</script>");
            }
            finally
            {
                ds.Clear();
            }

            //赋值
            Label1.Text = Depart;
            Label2.Text = specify;
            Label3.Text = Session["name"].ToString();
            Label4.Text = Session["username"].ToString();
            Label5.Text = class1;
            Label6.Text = preriod;
            Label7.Text = period_star.Year.ToString() + "年" + period_star.Month.ToString() + "月" + period_end.Day.ToString() + "日";
            Label8.Text = teacher_Name;
            Label9.Text = title;
            RadioButtonList1.SelectedValue = kind;
            Label10.Text = project_Name;
            Label11.Text = project_Depart;
            Label12.Text = project_Num;
            if (this.TextBox1.Text == "")
            {
                this.TextBox1.Text = content;
            }
            if (this.TextBox2.Text == "")
            {
                this.TextBox2.Text = target;
            }
            if (this.TextBox3.Text == "")
            {
                this.TextBox3.Text = reference;
            }
            if (this.TextBox4.Text == "")
            {
                this.TextBox4.Text = remark;
            }
        }
        //页面修改部分
    }
Пример #35
0
        public void SERACHPUR()
        {
            SqlDataAdapter    adapter1       = new SqlDataAdapter();
            SqlCommandBuilder sqlCmdBuilder1 = new SqlCommandBuilder();
            DataSet           ds             = new DataSet();


            ds.Clear();
            textBox1.Text = "0";
            textBox2.Text = "0";

            try
            {
                //20210902密
                Class1 TKID = new Class1();//用new 建立類別實體
                SqlConnectionStringBuilder sqlsb = new SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["dbconn"].ConnectionString);

                //資料庫使用者密碼解密
                sqlsb.Password = TKID.Decryption(sqlsb.Password);
                sqlsb.UserID   = TKID.Decryption(sqlsb.UserID);

                String connectionString;
                sqlConn = new SqlConnection(sqlsb.ConnectionString);


                sbSql.Clear();
                sbSqlQuery.Clear();


                sbSql.AppendFormat(@"  
                                    SELECT SUBSTRING(TH004,1,1) AS 'KINDS',CONVERT(INT,SUM(TH047+TH048)) AS 'MONEYS'
                                    FROM [TK].dbo.PURTG,[TK].dbo.PURTH
                                    WHERE TG001=TH001 AND TG002=TH002
                                    AND TH030='Y'
                                    AND SUBSTRING(TG003,1,6)='{0}' 
                                    AND (TH004 LIKE '1%' OR TH004 LIKE '2%' )
                                    GROUP BY SUBSTRING(TH004,1,1)  
                                    ", dateTimePicker4.Value.ToString("yyyyMM"));

                adapter1 = new SqlDataAdapter(@"" + sbSql, sqlConn);

                sqlCmdBuilder1 = new SqlCommandBuilder(adapter1);
                sqlConn.Open();
                ds.Clear();
                adapter1.Fill(ds, "TEMPds1");
                sqlConn.Close();


                if (ds.Tables["TEMPds1"].Rows.Count == 0)
                {
                }
                else
                {
                    if (ds.Tables["TEMPds1"].Rows.Count >= 1)
                    {
                        textBox1.Text = ds.Tables["TEMPds1"].Rows[0]["MONEYS"].ToString();
                        textBox2.Text = ds.Tables["TEMPds1"].Rows[1]["MONEYS"].ToString();
                    }
                }
            }
            catch
            {
            }
            finally
            {
            }
        }
    protected void lnkAdjMatched_OnClick(object sender, EventArgs e)
    {
        lblErrRep.Text = "";
        CAExcelRpt  xlobj   = new CAExcelRpt();
        CAClaimsDAL caobj   = new CAClaimsDAL();
        DataSet     dsFinal = new DataSet();

        dsFinal.Clear();
        DataSet ds = new DataSet();

        ds.Clear();

        string yrmo     = caobj.getLatestYRMOAdj();
        string filename = "CA_Claims_Recon_detail_" + yrmo;

        string[]   sheetnames = { "matched_Check&Amt", "mismatched_Amounts", "unmatchedCheck_Anthem", "unmatchedCheck_BOA", "duplicate_checks" };
        string[]   titles     = { "California Claims Reconciliation Matched Records by Check# and Amount for " + yrmo,
                                  "California Claims Reconciliation Mismatched Amount Records for " + yrmo,
                                  "California Claims Reconciliation Un-Matched Check Records from Anthem for " + yrmo,
                                  "California Claims Reconciliation Un-Matched Check Records from BOA for " + yrmo,
                                  "California Claims Reconciliation Duplicate Check Record Details for " + yrmo };
        string[][] colsFormat = { new string[] { "string",   "string",   "checknum", "string", "string", "string", "string", "string", "decimal", "string", "string",  "decimal", "decimal" },
                                  new string[] { "string",   "string",   "checknum", "string", "string", "string", "string", "string", "decimal", "string", "string",  "decimal", "decimal" },
                                  new string[] { "checknum", "string",   "string",   "string", "string", "string", "string", "string", "decimal" },
                                  new string[] { "checknum", "string",   "string",   "decimal" },
                                  new string[] { "string",   "checknum", "string",   "string", "string", "string", "string", "string", "string",  "string", "decimal", "decimal", "string"  } };

        try
        {
            ds = caobj.GetMatchedChecknAmtRecords(yrmo);
            ds.Tables[0].TableName = "matchedTable";
            dsFinal.Tables.Add(ds.Tables[0].Copy());
            dsFinal.Tables[0].TableName = "matchedTableF";
            ds.Clear();
            ds = caobj.GetAmtMismatchCheckRecords(yrmo);
            ds.Tables[0].TableName = "mismatchAmtTable";
            dsFinal.Tables.Add(ds.Tables[0].Copy());
            dsFinal.Tables[1].TableName = "mismatchAmtTableF";
            ds.Clear();
            ds = caobj.GetAnthMismatch(yrmo);
            ds.Tables[0].TableName = "AnthUnmatchedTable";
            dsFinal.Tables.Add(ds.Tables[0].Copy());
            dsFinal.Tables[2].TableName = "AnthUnmatchedTableF";
            ds.Clear();
            ds = caobj.GetBOAMismatch(yrmo);
            ds.Tables[0].TableName = "BOAUnmatchedTable";
            dsFinal.Tables.Add(ds.Tables[0].Copy());
            dsFinal.Tables[3].TableName = "BOAUnmatchedTableF";
            ds.Clear();
            ds = caobj.GetDupChecksDetails(yrmo);
            ds.Tables[0].TableName = "DupDtlTable";
            dsFinal.Tables.Add(ds.Tables[0].Copy());
            dsFinal.Tables[4].TableName = "DupDtlTableF";
            ds.Clear();
            xlobj.ExcelXMLRpt(dsFinal, filename, sheetnames, titles, colsFormat);
        }
        catch (Exception ex)
        {
            lblErrRep.Text = "Error in generating CA Claims Report of matched and mismatched records for YRMO - " + yrmo + "<br />" + ex.Message;
        }
    }
Пример #37
0
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X") || CheckUserPopedoms("6-1"))
                {
                    if (ispost)
                    {
                        int       sType            = Utils.StrToInt(HTTPRequest.GetString("sType"), 0);
                        string    PathStr          = Utils.GetMapPath(config.DataPath.ToString());
                        string    fileExtension    = "";
                        string    fileName         = "";
                        string    thispath         = DateTime.Now.Year + "-" + DateTime.Now.Month;
                        ArrayList filearr          = new ArrayList();
                        int       importdata_count = 0;

                        if (!Directory.Exists(PathStr + thispath))
                        {
                            Directory.CreateDirectory(PathStr + thispath);
                        }

                        //文件上传
                        HttpFileCollection files = HttpContext.Current.Request.Files;
                        try
                        {
                            if (files.Count > 0)
                            {
                                for (int i = 0; i < files.Count; i++)
                                {
                                    HttpPostedFile postedFile = files[i];
                                    fileName = System.IO.Path.GetFileName(postedFile.FileName);
                                    if (Utils.ChkSQL(fileName) != "")
                                    {
                                        fileExtension = System.IO.Path.GetExtension(fileName).ToLower();
                                        if (fileExtension == ".xls")
                                        {
                                            postedFile.SaveAs(PathStr + thispath + "/" + fileName);
                                            filearr.Add(PathStr + thispath + "/" + fileName);
                                        }
                                    }
                                }
                            }
                            if (filearr.Count > 0)
                            {
                                MarketingFeesInfo mi = new MarketingFeesInfo();
                                StoresInfo        si = new StoresInfo();
                                FeesSubjectInfo   fi = new FeesSubjectInfo();
                                StaffInfo         ft = new StaffInfo();
                                try
                                {
                                    for (int j = 0; j < filearr.Count; j++)
                                    {
                                        try
                                        {
                                            DataSet   ds = Excels.ExcelToDataTable(filearr[j].ToString());
                                            DataTable dt = new DataTable();
                                            try
                                            {
                                                dt = ds.Tables[0];
                                                foreach (DataRow dr in dt.Rows)
                                                {
                                                    mi.mAppendTime = DateTime.Now;


                                                    if (sType == 0)//营销费用
                                                    {
                                                        if (dr[0].ToString() != "" && dr[1].ToString() != "" && dr[2].ToString() != "" && dr[3].ToString() != "" && dr[4].ToString() != "")
                                                        {
                                                            if (Utils.IsNumeric(dr[3].ToString()))
                                                            {
                                                                si = tbStoresInfo.GetStoresInfoModelByName(dr[2].ToString().Trim());
                                                                if (si == null)
                                                                {
                                                                    si = tbStoresInfo.GetStoresInfoModelByCode(dr[1].ToString().Trim());
                                                                }
                                                                if (si != null)
                                                                {
                                                                    mi.StoresID = si.StoresID;
                                                                }
                                                                fi = tbFeesSubjectInfo.GetFeesSubjectInfoModelByName(dr[4].ToString().Trim());
                                                                if (fi != null)
                                                                {
                                                                    mi.FeesSubjectID = fi.FeesSubjectID;
                                                                }

                                                                mi.mRemark   = dr[5].ToString().Trim();
                                                                mi.mFees     = decimal.Parse(Utils.StrToFloat(dr[3].ToString().Trim(), 0).ToString());
                                                                mi.mDateTime = DateTime.Parse(dr[0].ToString().Trim());
                                                                mi.mType     = 0;
                                                                mi.StaffID   = 0;

                                                                if (tbMarketingFeesInfo.AddMarketingFeesInfo(mi) > 0)
                                                                {
                                                                    importdata_count++;
                                                                }
                                                            }
                                                        }
                                                    }
                                                    if (sType == 1)//公司费用
                                                    {
                                                        if (dr[0].ToString() != "" && dr[1].ToString() != "" && dr[2].ToString() != "" && dr[3].ToString() != "")
                                                        {
                                                            if (Utils.IsNumeric(dr[2].ToString()))
                                                            {
                                                                mi.StoresID  = 0;
                                                                mi.mDateTime = DateTime.Parse(dr[0].ToString().Trim());
                                                                fi           = tbFeesSubjectInfo.GetFeesSubjectInfoModelByName(dr[1].ToString().Trim());
                                                                if (fi != null)
                                                                {
                                                                    mi.FeesSubjectID = fi.FeesSubjectID;
                                                                }
                                                                mi.mFees = decimal.Parse(Utils.StrToFloat(dr[2].ToString().Trim(), 0).ToString());
                                                                ft       = tbStaffInfo.GetStaffInfoModelByName(dr[3].ToString().Trim());
                                                                if (ft != null)
                                                                {
                                                                    mi.StaffID = ft.StaffID;
                                                                }
                                                                mi.mType   = 1;
                                                                mi.mRemark = dr[4].ToString().Trim();

                                                                if (tbMarketingFeesInfo.AddMarketingFeesInfo(mi) > 0)
                                                                {
                                                                    importdata_count++;
                                                                }
                                                            }
                                                        }
                                                    }
                                                    if (sType == 2)//收入
                                                    {
                                                        if (dr[0].ToString() != "" && dr[1].ToString() != "" && dr[2].ToString() != "")
                                                        {
                                                            if (Utils.IsNumeric(dr[1].ToString()))
                                                            {
                                                                mi.StoresID  = 0;
                                                                mi.mDateTime = DateTime.Parse(dr[0].ToString().Trim());
                                                                if (dr[3].ToString().Trim() != "")
                                                                {
                                                                    fi = tbFeesSubjectInfo.GetFeesSubjectInfoModelByName(dr[3].ToString().Trim());
                                                                    if (fi != null)
                                                                    {
                                                                        mi.FeesSubjectID = fi.FeesSubjectID;
                                                                    }
                                                                }
                                                                else
                                                                {
                                                                    mi.FeesSubjectID = 0;
                                                                }
                                                                mi.mFees = decimal.Parse(Utils.StrToFloat(dr[1].ToString().Trim(), 0).ToString());
                                                                ft       = tbStaffInfo.GetStaffInfoModelByName(dr[2].ToString().Trim());
                                                                if (ft != null)
                                                                {
                                                                    mi.StaffID = ft.StaffID;
                                                                }
                                                                mi.mIsIncomeExpenditure = 1;
                                                                mi.mType   = -1;
                                                                mi.mRemark = dr[4].ToString().Trim();

                                                                if (tbMarketingFeesInfo.AddMarketingFeesInfo(mi) > 0)
                                                                {
                                                                    importdata_count++;
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            finally
                                            {
                                                ds.Clear();
                                                ds.Dispose();
                                            }
                                        }
                                        catch (Exception ex)
                                        {
                                            AddErrLine("<b>文件格式错误,请将 Xls 文件用 Excel 另存后再导入!</b>:<br>" + ex);
                                            //AddScript("window.setTimeout('history.back(1);',5000);");
                                        }
                                    }
                                    if (importdata_count > 0)
                                    {
                                        AddMsgLine("数据导入成功!共导入数据[" + importdata_count.ToString() + "]条.");
                                        AddScript("window.setTimeout('window.parent.HidBox();',5000);");
                                    }
                                    else
                                    {
                                        AddErrLine("系统忙!导入失败!");
                                        //AddScript("window.setTimeout('history.back(1);',1000);");
                                    }
                                }
                                finally
                                {
                                    mi = null;
                                    si = null;
                                    ft = null;
                                }
                            }
                            else
                            {
                                AddErrLine("为发现任何数据!导入失败!");
                                AddScript("window.setTimeout('history.back(1);',1000);");
                            }
                        }
                        finally
                        {
                            files = null;
                            filearr.Clear();
                        }
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                    AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
        }
Пример #38
0
    protected void btnGo_Click(object sender, EventArgs e)
    {
        try
        {
            lblErrSearch.Text      = string.Empty;
            lblErrSearch.Visible   = false;
            divPopupAlert.Visible  = false;
            lblAlertMsg.Text       = string.Empty;
            divMainContent.Visible = false;
            btnPrint.Visible       = false;
            btnSave.Visible        = false;
            qry            = string.Empty;
            qryCollegeCode = string.Empty;
            qryGraduate    = string.Empty;
            qryBatch       = string.Empty;
            qryCourse      = string.Empty;

            collegeCode = string.Empty;
            batchYear   = string.Empty;
            graduate    = string.Empty;
            courseId    = string.Empty;
            courseName  = string.Empty;

            string filterStream = string.Empty;
            if (ddlCollege.Items.Count > 0)
            {
                selected    = 0;
                collegeCode = string.Empty;
                Control c = ddlCollege;
                if (c is CheckBoxList)
                {
                    foreach (ListItem li in ddlCollege.Items)
                    {
                        if (li.Selected)
                        {
                            selected++;
                            if (string.IsNullOrEmpty(collegeCode.Trim()))
                            {
                                collegeCode = "'" + li.Value.Trim() + "'";
                            }
                            else
                            {
                                collegeCode += ",'" + li.Value.Trim() + "'";
                            }
                        }
                    }
                }
                else if (c is DropDownList)
                {
                    selected++;
                    collegeCode = "'" + Convert.ToString(ddlCollege.SelectedValue).Trim() + "'";
                }
                if (!string.IsNullOrEmpty(collegeCode) && selected > 0)
                {
                    qryCollegeCode = " and a.College_Code in(" + collegeCode + ")";
                }
            }
            else
            {
                lblAlertMsg.Text      = "No " + lblCollege.Text + " were Found";
                lblAlertMsg.Visible   = true;
                divPopupAlert.Visible = true;
                return;
            }

            if (ddlBatch.Items.Count > 0)
            {
                selected  = 0;
                batchYear = string.Empty;
                Control c = ddlBatch;
                if (c is CheckBoxList)
                {
                    foreach (ListItem li in ddlBatch.Items)
                    {
                        if (li.Selected)
                        {
                            selected++;
                            if (string.IsNullOrEmpty(batchYear.Trim()))
                            {
                                batchYear = "'" + li.Value.Trim() + "'";
                            }
                            else
                            {
                                batchYear += ",'" + li.Value.Trim() + "'";
                            }
                        }
                    }
                }
                else if (c is DropDownList)
                {
                    selected++;
                    batchYear = "'" + Convert.ToString(ddlBatch.SelectedValue).Trim() + "'";
                }
                if (!string.IsNullOrEmpty(batchYear) && selected > 0)
                {
                    qryBatch = " and a.Batch_Year in(" + batchYear + ")";
                }
            }
            else
            {
                lblAlertMsg.Text      = "No " + lblBatch.Text + " were Found";
                lblAlertMsg.Visible   = true;
                divPopupAlert.Visible = true;
                return;
            }

            if (ddlEduLevel.Items.Count == 0)
            {
                lblAlertMsg.Text      = "No " + lblEduLevel.Text + " were Found";
                lblAlertMsg.Visible   = true;
                divPopupAlert.Visible = true;
                return;
            }

            if (ddlCourse.Items.Count > 0)
            {
                selected  = 0;
                qryCourse = string.Empty;
                courseId  = string.Empty;
                Control c = ddlCourse;
                if (c is CheckBoxList)
                {
                    foreach (ListItem li in ddlCourse.Items)
                    {
                        if (li.Selected)
                        {
                            selected++;
                            if (string.IsNullOrEmpty(courseId.Trim()))
                            {
                                courseId = "'" + li.Value.Trim() + "'";
                            }
                            else
                            {
                                courseId += ",'" + li.Value.Trim() + "'";
                            }
                        }
                    }
                }
                else if (c is DropDownList)
                {
                    selected++;
                    courseId = "'" + Convert.ToString(ddlCourse.SelectedValue).Trim() + "'";
                }
                if (!string.IsNullOrEmpty(courseId) && selected > 0)
                {
                    qryCourse = " and a.courseId in(" + courseId + ")";
                }
            }
            else
            {
                lblAlertMsg.Text      = "No " + lblCourse.Text + " were Found";
                lblAlertMsg.Visible   = true;
                divPopupAlert.Visible = true;
                return;
            }

            DataTable dtCourseDet = new DataTable();
            dtCourseDet.Columns.Add("courseID", typeof(string));
            dtCourseDet.Columns.Add("CourseName", typeof(string));
            dtCourseDet.Columns.Add("DegreeName", typeof(string));
            dtCourseDet.Columns.Add("DegreeCode", typeof(string));
            dtCourseDet.Columns.Add("DeptCode", typeof(string));
            dtCourseDet.Columns.Add("eduLevel", typeof(string));
            dtCourseDet.Columns.Add("Priority", typeof(string));
            dtCourseDet.Columns.Add("NoOfseats", typeof(string));
            dtCourseDet.Columns.Add("NoofSections", typeof(string));
            dtCourseDet.Columns.Add("sectionName", typeof(string));
            dtCourseDet.Columns.Add("sectionNo", typeof(string));
            dtCourseDet.Columns.Add("studentCount", typeof(string));

            DataView dv          = new DataView();
            DataSet  dsCourseDet = new DataSet();
            if (!string.IsNullOrEmpty(collegeCode) && !string.IsNullOrEmpty(batchYear) && !string.IsNullOrEmpty(qryCourse) && !string.IsNullOrEmpty(collegeCode))
            {
                if (cb_Check.Checked == false)
                {
                    qry  = "select c.Course_Id,dt.Dept_Code,dg.Degree_Code,c.Edu_Level,c.Course_Name,dt.Dept_Name,iSNULL(dg.No_Of_seats,'0') as No_Of_seats,ISnull(dg.NoofSections,'1') as NoofSections,Isnull(c.Priority,'0') Priority,sd.batchYear,LTRIM(RTRIM(ISNULL(sd.sectionName,''))) as sectionName,ISNULL(sd.studentCount,'0') as studentCount,LTRIM(RTRIM(ISNULL(sd.sectionNo,'1'))) as sectionNo from Degree dg join  Course c on c.Course_Id=dg.Course_Id and c.college_code=dg.college_code join Department dt on dt.Dept_Code=dg.Dept_Code and dg.college_code=dt.college_code and dt.college_code=c.college_code left join sectionDetails sd on dg.Degree_Code=sd.degreeCode where c.Course_Id in(" + courseId + ") and c.college_code in(" + collegeCode + ")  order by dg.Degree_Code";
                    qry += " select Nsections as  NoofSections,degree_code,batch_year  from NDegree where  batch_year ='" + ddlBatch.SelectedValue + "'";
                    dsCourseDet.Clear();
                    dsCourseDet = d2.select_method_wo_parameter(qry, "text");

                    if (dsCourseDet.Tables.Count > 0 && dsCourseDet.Tables[0].Rows.Count > 0)
                    {
                        DataRow   drCourseDet;
                        DataTable dtDistintCourses = new DataTable();
                        dtDistintCourses = dsCourseDet.Tables[0].DefaultView.ToTable(true, "Course_Name", "Course_Id", "Dept_Code", "Degree_Code", "Edu_Level", "Dept_Name", "No_Of_seats", "NoofSections", "Priority");
                        foreach (DataRow drCourse in dtDistintCourses.Rows)
                        {
                            string Course_Name  = Convert.ToString(drCourse["Course_Name"]).Trim();
                            string Course_Id    = Convert.ToString(drCourse["Course_Id"]).Trim();
                            string Dept_Code    = Convert.ToString(drCourse["Dept_Code"]).Trim();
                            string Degree_Code  = Convert.ToString(drCourse["Degree_Code"]).Trim();
                            string Edu_Level    = Convert.ToString(drCourse["Edu_Level"]).Trim();
                            string Dept_Name    = Convert.ToString(drCourse["Dept_Name"]).Trim();
                            string No_Of_seats  = Convert.ToString(drCourse["No_Of_seats"]).Trim();
                            string NoofSections = Convert.ToString(drCourse["NoofSections"]).Trim();
                            string Priority     = Convert.ToString(drCourse["Priority"]).Trim();
                            int    nofSeats     = 0;
                            int    noOfSections = 0;
                            int    autochar     = 65;
                            int.TryParse(No_Of_seats, out nofSeats);
                            int.TryParse(NoofSections, out noOfSections);
                            if (noOfSections == 0)
                            {
                                noOfSections = 1;
                            }
                            dsCourseDet.Tables[1].DefaultView.RowFilter = " Degree_Code='" + Degree_Code + "' and batch_year='" + ddlBatch.SelectedItem.Text + "'";
                            dv = dsCourseDet.Tables[1].DefaultView;
                            if (dv.Count > 0)
                            {
                                int.TryParse(Convert.ToString(dv[0]["NoofSections"]), out noOfSections);
                            }

                            for (int startSection = 1; startSection <= noOfSections; startSection++)
                            {
                                DataTable dtSectionsDetails = new DataTable();
                                if (dsCourseDet.Tables[0].Rows.Count > 0)
                                {
                                    dsCourseDet.Tables[0].DefaultView.RowFilter = "Course_Id='" + Course_Id + "' and Degree_Code='" + Degree_Code + "' and Edu_Level='" + Edu_Level + "' and sectionName='" + (char)(autochar) + "' and batchYear='" + Convert.ToString(ddlBatch.SelectedValue).Trim() + "'";
                                    dtSectionsDetails = dsCourseDet.Tables[0].DefaultView.ToTable();
                                }
                                drCourseDet                 = dtCourseDet.NewRow();
                                drCourseDet["courseID"]     = (dtSectionsDetails.Rows.Count > 0) ? Convert.ToString(dtSectionsDetails.Rows[0]["Course_Id"]).Trim() : Convert.ToString(Course_Id).Trim();
                                drCourseDet["CourseName"]   = (dtSectionsDetails.Rows.Count > 0) ? Convert.ToString(dtSectionsDetails.Rows[0]["Course_Name"]).Trim() : Convert.ToString(Course_Name).Trim();
                                drCourseDet["DegreeName"]   = (dtSectionsDetails.Rows.Count > 0) ? Convert.ToString(dtSectionsDetails.Rows[0]["Dept_Name"]).Trim() : Convert.ToString(Dept_Name).Trim();
                                drCourseDet["DeptCode"]     = (dtSectionsDetails.Rows.Count > 0) ? Convert.ToString(dtSectionsDetails.Rows[0]["Dept_Code"]).Trim() : Convert.ToString(Dept_Code).Trim();
                                drCourseDet["DegreeCode"]   = (dtSectionsDetails.Rows.Count > 0) ? Convert.ToString(dtSectionsDetails.Rows[0]["Degree_Code"]).Trim() : Convert.ToString(Degree_Code).Trim();
                                drCourseDet["eduLevel"]     = (dtSectionsDetails.Rows.Count > 0) ? Convert.ToString(dtSectionsDetails.Rows[0]["Edu_Level"]).Trim() : Convert.ToString(Edu_Level).Trim();
                                drCourseDet["NoOfseats"]    = (dtSectionsDetails.Rows.Count > 0) ? Convert.ToString(dtSectionsDetails.Rows[0]["No_Of_seats"]).Trim() : Convert.ToString(No_Of_seats).Trim();
                                drCourseDet["NoofSections"] = (dtSectionsDetails.Rows.Count > 0) ? Convert.ToString(dtSectionsDetails.Rows[0]["NoofSections"]).Trim() : Convert.ToString(NoofSections).Trim();
                                drCourseDet["Priority"]     = (dtSectionsDetails.Rows.Count > 0) ? Convert.ToString(dtSectionsDetails.Rows[0]["Priority"]).Trim() : Convert.ToString(Priority).Trim();
                                drCourseDet["sectionName"]  = (dtSectionsDetails.Rows.Count > 0) ? Convert.ToString(dtSectionsDetails.Rows[0]["sectionName"]).Trim() : Convert.ToString((char)(autochar)).Trim();
                                drCourseDet["sectionNo"]    = (dtSectionsDetails.Rows.Count > 0) ? Convert.ToString(dtSectionsDetails.Rows[0]["sectionNo"]).Trim() : Convert.ToString(startSection).Trim();
                                drCourseDet["studentCount"] = (dtSectionsDetails.Rows.Count > 0) ? Convert.ToString(dtSectionsDetails.Rows[0]["studentCount"]).Trim() : Convert.ToString("").Trim();
                                dtCourseDet.Rows.Add(drCourseDet);
                                autochar++;
                            }
                        }
                    }
                    //if (dtCourseDet.Rows.Count > 0)
                    //{
                    //    gvSectionWiseCount.DataSource = dtCourseDet;
                    //    gvSectionWiseCount.DataBind();
                    //    gvSectionWiseCount.Visible = true;
                    //    divMainContent.Visible = true;
                    //}
                    //else
                    //{

                    //}


                    if (dtCourseDet.Rows.Count > 0)
                    {
                        gvSectionWiseCount.DataSource = dtCourseDet;
                        gvSectionWiseCount.DataBind();
                        btnPrint.Visible       = true;
                        btnSave.Visible        = true;
                        divMainContent.Visible = true;
                        divShowcontant.Visible = false;
                    }
                    else
                    {
                        lblAlertMsg.Text       = "No Record(s) were Found";
                        lblAlertMsg.Visible    = true;
                        divPopupAlert.Visible  = true;
                        divShowcontant.Visible = false;
                        return;
                    }
                }
                if (cb_Check.Checked == true)
                {
                    qry = "select c.Course_Id,dt.Dept_Code,d.Degree_Code,c.Edu_Level,c.Course_Name,dt.Dept_Name,isnull(ElectiveCount,0) as ElectiveCount from Degree d,Ndegree N,Department dt,Course c where d.Degree_Code =N.Degree_code and d.Dept_Code =dt.Dept_Code and c.Course_Id =d.Course_Id and d.college_code =" + collegeCode + " and c.Course_Id =" + courseId + " and N.batch_year ='" + ddlBatch.SelectedItem.Text + "'";
                    dsCourseDet.Clear();
                    dsCourseDet = d2.select_method_wo_parameter(qry, "text");
                    if (dsCourseDet.Tables.Count > 0 && dsCourseDet.Tables[0].Rows.Count > 0)
                    {
                        GridView1.DataSource = dsCourseDet.Tables[0];
                        GridView1.DataBind();
                        GridView1.Visible      = true;
                        btnPrint.Visible       = true;
                        btnSave.Visible        = true;
                        divShowcontant.Visible = true;
                        //divMainContent.Visible = true;
                    }
                    else
                    {
                        lblAlertMsg.Text       = "No Record(s) were Found";
                        lblAlertMsg.Visible    = true;
                        divPopupAlert.Visible  = true;
                        divShowcontant.Visible = false;
                        return;
                    }
                }
            }
        }
        catch (Exception ex)
        {
            //lblErrSearch.Text = Convert.ToString(ex);
            //lblErrSearch.Visible = true;
            ////d2.sendErrorMail(ex, (ddlCollege.Items.Count > 0 ? Convert.ToString(ddlCollege.SelectedValue).Trim() : ((Session["collegecode"] != null) ? Convert.ToString(Session["collegecode"]).Trim() : "13")), System.IO.Path.GetFileName(Request.Url.AbsolutePath).ToString());
        }
    }
Пример #39
0
        private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            rm = 0;
            if (dataGridView1.Columns[e.ColumnIndex].Name == "Quantity")
            {
                int    columnIndex = dataGridView1.CurrentCell.ColumnIndex;
                int    rowIndex    = dataGridView1.CurrentCell.RowIndex;
                string s1          = dataGridView1.Rows[rowIndex].Cells[columnIndex].Value.ToString(); //2nd columns cell value
                Int16  q           = Convert.ToInt16(s1);
                string s2          = dataGridView1.Rows[rowIndex].Cells[1].Value.ToString();

                SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=" + GlobalVariable.path + "\\Inv.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
                con.Open();
                SqlDataAdapter sda = new SqlDataAdapter("Select * From Item where Item_no = '" + s2 + "' ", con);
                DataTable      dt  = new DataTable();
                sda.Fill(dt);
                Int64  p  = Convert.ToInt64(dt.Rows[0].ItemArray[2].ToString());
                Int64  np = q * p;
                Double d  = Convert.ToDouble(dt.Rows[0].ItemArray[3].ToString());
                Double nd = np * (d / 100);
                con.Close();
                {
                    SqlConnection  con1 = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=" + GlobalVariable.path + "\\Inv.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
                    SqlCommand     cmd1 = new SqlCommand();
                    SqlDataAdapter da1  = new SqlDataAdapter();
                    cmd1.CommandText  = "UPDATE Trans set Quantity = ' " + q + " ', Value = ' " + np + " ' , Discount = ' " + nd + " '   where Bill_no = '" + billno.Text + "' and Item_no = '" + s2 + "'";
                    cmd1.CommandType  = CommandType.Text;
                    cmd1.Connection   = con1;
                    da1.UpdateCommand = cmd1;
                    con1.Open();
                    da1.UpdateCommand.ExecuteNonQuery();
                    con1.Close();
                }
                try
                {
                    SqlConnection  con3 = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=" + GlobalVariable.path + "\\Inv.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
                    SqlDataAdapter sda3 = new SqlDataAdapter("Select Bill_no,Item_no,Item_name,Quantity,Price,Discount,Value From Trans where Bill_no = '" + billno.Text + "'", con3);
                    ds.Clear();
                    sda3.Fill(ds, "Trans");
                    DataTable dt3 = new DataTable();
                    sda3.Fill(dt3);
                    con3.Open();
                    dataGridView1.DataSource = ds.Tables[0];
                    con3.Close();

                    int   j = dt3.Rows.Count;
                    int   i = 0;
                    Int64 tq = 0, tp = 0, td = 0;
                    for (i = 0; i < j; i++)
                    {
                        tq = tq + Convert.ToInt64(dt3.Rows[i].ItemArray[3]);
                        tp = tp + Convert.ToInt64(dt3.Rows[i].ItemArray[6]);
                        td = td + Convert.ToInt64(dt3.Rows[i].ItemArray[5]);
                    }
                    con3.Close();

                    tqty.Text    = tq.ToString();
                    tdiscnt.Text = td.ToString();
                    tprice.Text  = tp.ToString();
                }
                catch (Exception ex) { MessageBox.Show(ex.Message); }
            }
        }
Пример #40
0
 //��������ת��
 //��ʵ���ǽ�dataset�����ݶ�����xml�ļ���Ȼ�������
 public static DataSet ISO8859_GB2312(DataSet ds)
 {
     #region
     string xml;
     xml = ds.GetXml();
     ds.Clear();
     //�����ַ���
     System.Text.Encoding iso8859, gb2312;
     //iso8859
     iso8859 = System.Text.Encoding.GetEncoding("iso8859-1");
     //����2312
     gb2312 = System.Text.Encoding.GetEncoding("gb2312");
     byte[] bt;
     bt = iso8859.GetBytes(xml);
     xml = gb2312.GetString(bt);
     ds.ReadXml(new System.IO.StringReader(xml));
     return ds;
     #endregion
 }
        protected override string DoIt()
        {
            string status = "OK";

            // Trx trx = Get_Trx();
            ds.Clear();
            try
            {
                ds = DB.ExecuteDataset(@"SELECT distinct cl.AD_Client_ID,
                                          cl.AD_Org_ID,
                                          cl.CurrencyRateUpdateFrequency,
                                          acct.C_Currency_ID
                                          ,cr.ISO_Code,cl.C_CurrencySource_ID
                                        FROM ad_client cl
                                        INNER JOIN AD_CLientinfo ci
                                        ON ci.ad_client_ID=cl.ad_client_ID
                                        INNER JOIN C_AcctSchema acct
                                        ON acct.C_AcctSchema_ID             =ci.C_AcctSchema1_ID
                                        Left Join C_Currency cr on cr.C_Currency_ID=acct.C_Currency_ID
                                        WHERE cl.ad_client_Id!              =0 AND cl.UpdateCurrencyRate='A' AND cl.IsMultiCurrency='Y'
                                        AND cl.currencyrateupdatefrequency IS NOT NULL");

                //                                                        Where ci.AD_CLient_ID= " + GetAD_Client_ID());
                //in this DataSet we'll get CLient's Base Currency & the Currency ID
                // int clientCount = ds.Tables[0].Rows.Count;
                if (ds.Tables[0].Rows.Count > 0)
                {
                    _lstCurr = new List <CurrencyProp>();
                }
                else
                {
                    return(VAdvantage.Utility.Msg.GetMsg(GetCtx(), "NoMultiCurrencySettingsFound"));
                }

                for (int j = 0; j < ds.Tables[0].Rows.Count; j++)
                {
                    CurrencyProp _curr = new CurrencyProp();
                    _curr.baseCurrency   = Convert.ToString(ds.Tables[0].Rows[j]["ISO_Code"]);
                    _curr.baseCurrencyID = Convert.ToInt32(ds.Tables[0].Rows[j]["C_Currency_ID"]);
                    _curr.frequency      = Convert.ToString(ds.Tables[0].Rows[j]["CurrencyRateUpdateFrequency"]);
                    _curr.AD_Client_ID   = Convert.ToInt32(ds.Tables[0].Rows[j]["AD_Client_ID"]);
                    _curr.AD_Org_ID      = Convert.ToInt32(ds.Tables[0].Rows[j]["AD_Org_ID"]);
                    _curr.CurrencySource = Convert.ToInt32(ds.Tables[0].Rows[j]["C_CurrencySource_ID"]);
                    _lstCurr.Add(_curr);
                }
                ds.Clear();
                sql = @"Select Cur.ISO_Code, Cur.C_Currency_ID From C_Currency Cur  Where Cur.IsMyCurrency='Y' And Cur.IsActive='Y' ";
                ds  = DB.ExecuteDataset(sql); // Here we get all currencies in which our Client is in dealing with
                //String frequency;// = DB.ExecuteScalar("Select currencyrateupdatefrequency from AD_Client where IsActive='Y' AND currencyrateupdatefrequency is not null").ToString();
                // getting the frequency(TimePeriod) for the converted rate

                if (ds != null)
                {
                    for (Int32 k = 0; k < _lstCurr.Count; k++)
                    {
                        string currencySourceName = DB.ExecuteScalar("Select url from C_CurrencySource Where C_CurrencySource_ID=" + _lstCurr[k].CurrencySource).ToString();

                        //int defaultconversionType = 0;
                        //try
                        //{
                        //    defaultconversionType = Convert.ToInt32(DB.ExecuteScalar(@"SELECT C_ConversionType_id, Surchargepercentage,Surchargevalue FROM c_conversiontype WHERE autocalculate='Y' AND isactive   ='Y'"));
                        //}
                        //catch
                        //{

                        //}

                        DataSet dsConversion = DB.ExecuteDataset(@"SELECT C_ConversionType_id, Surchargepercentage,Surchargevalue,CurrencyRateUpdateFrequency FROM c_conversiontype WHERE isautocalculate='Y' AND isactive   ='Y'");
                        if (dsConversion != null && dsConversion.Tables[0].Rows.Count > 0)
                        {
                            for (int x = 0; x < dsConversion.Tables[0].Rows.Count; x++)
                            {
                                int defaultconversionType = 0;
                                defaultconversionType = Convert.ToInt32(dsConversion.Tables[0].Rows[x]["C_ConversionType_id"]);

                                MConversionRate conversion = null;
                                Decimal         rate1      = 0;
                                Decimal         rate2      = 0;
                                Decimal         one        = new Decimal(1.0);

                                string updateFrequency = _lstCurr[k].frequency;

                                if (dsConversion.Tables[0].Rows[x]["CurrencyRateUpdateFrequency"] != null && dsConversion.Tables[0].Rows[x]["CurrencyRateUpdateFrequency"] != DBNull.Value &&
                                    Convert.ToString(dsConversion.Tables[0].Rows[x]["CurrencyRateUpdateFrequency"]) != "")
                                {
                                    updateFrequency = Convert.ToString(dsConversion.Tables[0].Rows[x]["CurrencyRateUpdateFrequency"]);
                                }


                                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                                {
                                    myCurrency   = ds.Tables[0].Rows[i]["ISO_Code"].ToString();
                                    myCurrencyID = Util.GetValueOfInt(ds.Tables[0].Rows[i]["C_Currency_ID"]);
                                    sql          = String.Empty;
                                    sql          = @"  Select ValidTo from C_Conversion_Rate  where IsActive='Y' AND C_ConversionType_id=" + defaultconversionType + " AND  C_Currency_ID=" + _lstCurr[k].baseCurrencyID + " AND C_Currency_To_ID=" + myCurrencyID
                                                   + "  AND Created=(SELECT Max(Created) FROM C_Conversion_Rate  WHERE isactive      ='Y' AND C_ConversionType_id=" + defaultconversionType + " AND "
                                                   + "  C_Currency_ID   =" + _lstCurr[k].baseCurrencyID + "  AND C_Currency_To_ID=" + myCurrencyID + ") AND AD_Client_ID = " + _lstCurr[k].AD_Client_ID + "AND AD_Org_ID= " + _lstCurr[k].AD_Org_ID;
                                    //the Maximum date from Converted rate of every currency


                                    if (DateTime.Now.Date > Convert.ToDateTime(DB.ExecuteScalar(sql.Trim(), null, null)).Date)
                                    {
                                        if (!String.IsNullOrEmpty(myCurrency) && !String.IsNullOrEmpty(_lstCurr[k].baseCurrency) &&
                                            !String.IsNullOrEmpty(currencySourceName) && (myCurrencyID != _lstCurr[k].baseCurrencyID))
                                        {
                                            String result = GetConvertedCurrencyValue(_lstCurr[k].baseCurrency, myCurrency, currencySourceName);
                                            if (!String.IsNullOrEmpty(result))
                                            {
                                                conversion = new MConversionRate(GetCtx(), 0, null);
                                                conversion.SetAD_Org_ID((_lstCurr[k].AD_Org_ID));
                                                conversion.SetAD_Client_ID(_lstCurr[k].AD_Client_ID);
                                                //conversion.SetValidFrom(DateTime.Now.AddDays(-1));
                                                conversion.SetValidFrom(DateTime.Now);
                                                if (updateFrequency.Equals("D"))
                                                {
                                                    conversion.SetValidTo(DateTime.Now);
                                                }
                                                else if (updateFrequency.Equals("W"))
                                                {
                                                    conversion.SetValidTo(DateTime.Now.AddDays(7));
                                                }
                                                else if (updateFrequency.Equals("M"))
                                                {
                                                    conversion.SetValidTo(DateTime.Now.AddMonths(1));
                                                }

                                                conversion.SetC_ConversionType_ID(defaultconversionType);
                                                conversion.SetC_Currency_ID(_lstCurr[k].baseCurrencyID);
                                                conversion.SetC_Currency_To_ID(myCurrencyID);

                                                rate2 = VAdvantage.Utility.Env.ZERO;
                                                one   = new Decimal(1.0);

                                                //if (dsConversion.Tables[0].Rows[x]["Surchargepercentage"] != null && dsConversion.Tables[0].Rows[x]["Surchargepercentage"] != DBNull.Value
                                                //    && Convert.ToDecimal(dsConversion.Tables[0].Rows[x]["Surchargepercentage"]) != 0)
                                                //{
                                                //    rate1 = (Convert.ToDecimal(result) + (Convert.ToDecimal(result) * (Convert.ToDecimal(dsConversion.Tables[0].Rows[x]["Surchargepercentage"]) / 100)));
                                                //    if (System.Convert.ToDouble(rate1) != 0.0)	//	no divide by zero
                                                //    {
                                                //        rate2 = Decimal.Round(Decimal.Divide(one, Convert.ToDecimal(result)), 12);// MidpointRounding.AwayFromZero);
                                                //    }
                                                //    rate2 = (rate2 + rate2 * (Convert.ToDecimal(dsConversion.Tables[0].Rows[x]["Surchargepercentage"]) / 100));
                                                //}
                                                //else if (dsConversion.Tables[0].Rows[x]["Surchargevalue"] != null && dsConversion.Tables[0].Rows[x]["Surchargevalue"] != DBNull.Value
                                                //    && Convert.ToDecimal(dsConversion.Tables[0].Rows[x]["Surchargevalue"]) != 0)
                                                //{
                                                //    rate1 = (Convert.ToDecimal(result) + Convert.ToDecimal(dsConversion.Tables[0].Rows[x]["Surchargevalue"]));
                                                //    if (System.Convert.ToDouble(rate1) != 0.0)	//	no divide by zero
                                                //    {
                                                //        rate2 = Decimal.Round(Decimal.Divide(one, Convert.ToDecimal(result)), 12);// MidpointRounding.AwayFromZero);
                                                //    }
                                                //    rate2 = (rate2 + Convert.ToDecimal(dsConversion.Tables[0].Rows[x]["Surchargevalue"]));
                                                //}
                                                //else
                                                //{
                                                //    rate1 = Convert.ToDecimal(result);
                                                //    if (System.Convert.ToDouble(rate1) != 0.0)	//	no divide by zero
                                                //    {
                                                //        rate2 = Decimal.Round(Decimal.Divide(one, Convert.ToDecimal(result)), 12);// MidpointRounding.AwayFromZero);
                                                //    }
                                                //}

                                                rate1 = Convert.ToDecimal(result);

                                                //if (System.Convert.ToDouble(rate1) != 0.0)	//	no divide by zero
                                                //{
                                                //    rate2 = Decimal.Round(Decimal.Divide(one, Convert.ToDecimal(result)), 12);// MidpointRounding.AwayFromZero);
                                                //}
                                                conversion.SetMultiplyRate(rate1);
                                                //conversion.SetDivideRate(rate2);
                                                if (!conversion.Save())
                                                {
                                                    //status = "ConversionRateNotsaved";
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                //trx.Rollback();
                //status = ex.Message;
                //trx.Close();
                return(status);
            }
            //trx.Commit();
            //trx.Close();
            ds.Dispose();
            _lstCurr = null;
            return(status);
        }
Пример #42
0
 public void ClearData() =>
 _data?.Clear();
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            if (persianDatePicker1.Text == "")
            {
                MessageBox.Show("لطفا تاریخ واریز را تکمیل نمایید", "", MessageBoxButton.OK, MessageBoxImage.Error);
                persianDatePicker1.Focus();
                return;
            }

            if (textBox2.Text == "")
            {
                MessageBox.Show("لطفا مبلغ را تکمیل نمایید", "", MessageBoxButton.OK, MessageBoxImage.Error);
                textBox2.Focus();
                return;
            }

            if (Convert.ToInt32(textBox2.Text) < 1000000)
            {
                MessageBox.Show("لطفا مبلغ را صحیح وارد نمایید", "", MessageBoxButton.OK, MessageBoxImage.Error);
                textBox2.Focus();
                return;
            }

            if (comboBox1.SelectedIndex == -1)
            {
                MessageBox.Show("لطفا بانک را انتخاب نمایید", "", MessageBoxButton.OK, MessageBoxImage.Error);
                comboBox1.Focus();
                return;
            }

            if (textBox3.Text == "")
            {
                MessageBox.Show("لطفا شماره فیش را تکمیل نمایید", "", MessageBoxButton.OK, MessageBoxImage.Error);
                textBox3.Focus();
                return;
            }

            if (comboBox2.SelectedIndex == -1)
            {
                MessageBox.Show("لطفا بابت را انتخاب نمایید", "", MessageBoxButton.OK, MessageBoxImage.Error);
                comboBox2.Focus();
                return;
            }

            SqlCommand objCommand1 = new SqlCommand();

            objCommand1.Connection  = objConnection;
            objCommand1.CommandText = "INSERT INTO infokhodromali (idshobe,idkhodro,eachdate,bank1,prompt,shfish,moneyvariz,S1_rad) VALUES (@idshobe,@idkhodro,@eachdate,@bank1,@prompt,@shfish,@moneyvariz,@S1_rad)";
            objCommand1.CommandType = CommandType.Text;

            objCommand1.Parameters.AddWithValue("@idshobe", id_idshobe);
            objCommand1.Parameters.AddWithValue("@idkhodro", id_idmen);
            objCommand1.Parameters.AddWithValue("@eachdate", u_set.control_date_end(persianDatePicker1.Text));
            objCommand1.Parameters.AddWithValue("@bank1", comboBox1.Text);
            objCommand1.Parameters.AddWithValue("@prompt", comboBox2.Text);
            objCommand1.Parameters.AddWithValue("@shfish", textBox3.Text);
            objCommand1.Parameters.AddWithValue("@moneyvariz", Convert.ToInt32(textBox2.Text));
            objCommand1.Parameters.AddWithValue("@S1_rad", id_Contract);

            objConnection.Open();
            objCommand1.ExecuteNonQuery();
            objConnection.Close();

            u_set.u_amal_register("2", this.Title, id_Contract, "3", "ویرایش");

            objDataSet.Clear();
            Database.Connection_Open();
            Database.Fill("SELECT * FROM infokhodromali WHERE (S1_rad = '" + id_Contract + "')", objDataSet, "ONE_All_End_Farsode_list", true);
            Database.Connection_Close();

            dataGrid1.DataContext = objDataSet;

            alborz_calc_money();

            MessageBox.Show("اطلاعات با موفقیت ثبت شد", "", MessageBoxButton.OK, MessageBoxImage.Information);
        }
Пример #44
0
 public virtual int FillBy(DataSet.SheetsDataTable dataTable, int SheetID) {
     this.Adapter.SelectCommand = this.CommandCollection[1];
     this.Adapter.SelectCommand.Parameters[0].Value = ((int)(SheetID));
     if ((this.ClearBeforeFill == true)) {
         dataTable.Clear();
     }
     int returnValue = this.Adapter.Fill(dataTable);
     return returnValue;
 }
Пример #45
0
 public virtual int FillByAuthKey(DataSet.SubscriberDataTable dataTable, string AuthenticationKey) {
     this.Adapter.SelectCommand = this.CommandCollection[1];
     if ((AuthenticationKey == null)) {
         throw new global::System.ArgumentNullException("AuthenticationKey");
     }
     else {
         this.Adapter.SelectCommand.Parameters[0].Value = ((string)(AuthenticationKey));
     }
     if ((this.ClearBeforeFill == true)) {
         dataTable.Clear();
     }
     int returnValue = this.Adapter.Fill(dataTable);
     return returnValue;
 }