Inheritance: System.ComponentModel.MarshalByValueComponent, IListSource, IXmlSerializable, ISupportInitializeNotification, ISupportInitialize, ISerializable
Ejemplo n.º 1
3
        public static DataTable GetHandoverLogByHandoverLogId(int handoverLogId)
        {
            string connectionString = ConnectionStringFactory.GetNXJCConnectionString();
            DataSet ds = new DataSet();

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                SqlCommand command = connection.CreateCommand();
                command.CommandText = @"SELECT  WorkingTeamShiftLog.*,
                                                StaffInfo.Name AS ChargeManName, ProductLine.Name AS ProductLineName,
                                                WorkingTeam.Name AS WorkingTeamName
                                        FROM    WorkingTeam INNER JOIN
                                                StaffInfo INNER JOIN
                                                WorkingTeamShiftLog ON StaffInfo.ID = WorkingTeamShiftLog.ChargeManID INNER JOIN
                                                ProductLine ON WorkingTeamShiftLog.ProductLineID = ProductLine.ID ON
                                                WorkingTeam.ID = WorkingTeamShiftLog.WorkingTeamID
                                        WHERE   (WorkingTeamShiftLog.ID = @workingTeamShiftLogID)";

                command.Parameters.Add(new SqlParameter("workingTeamShiftLogID", handoverLogId));
                SqlDataAdapter adapter = new SqlDataAdapter(command);
                adapter.Fill(ds);
            }

            return ds.Tables[0];
        }
Ejemplo n.º 2
2
        public static void LerUsuarios_Desconectado()
        {
            DataSet ds = new DataSet();

            using (var con = ObterConexao())
            {
                var cmd = con.CreateCommand();

                cmd.CommandText = "SELECT * FROM Usuario";

                SqlDataAdapter da = new SqlDataAdapter(cmd);

                da.Fill(ds);
            }

            foreach (DataTable table in ds.Tables)
            {
                foreach (DataColumn column in table.Columns)
                {
                    foreach (DataRow row in table.Rows)
                    {
                        Console.WriteLine("{0}: {1}", column.ColumnName, row[column.ColumnName]);
                    }
                }
            }

            Console.Read();
        }
	//Activate This Construntor to log All To Standard output
	//public TestClass():base(true){}

	//Activate this constructor to log Failures to a log file
	//public TestClass(System.IO.TextWriter tw):base(tw, false){}


	//Activate this constructor to log All to a log file
	//public TestClass(System.IO.TextWriter tw):base(tw, true){}

	//BY DEFAULT LOGGING IS DONE TO THE STANDARD OUTPUT ONLY FOR FAILURES

	public void run()
	{
		Exception exp = null;

		DataSet ds = new DataSet();
		DataTable dtParent = GHTUtils.DataProvider.CreateParentDataTable();
		DataTable dtChild = GHTUtils.DataProvider.CreateChildDataTable();
		ds.Tables.Add(dtParent);
		ds.Tables.Add(dtChild);
		
		ForeignKeyConstraint fc = null;
		fc = new ForeignKeyConstraint(dtParent.Columns[0],dtChild.Columns[0]);

		try
		{
			BeginCase("default ");
			Compare(fc.ConstraintName ,string.Empty );
		}
		catch(Exception ex)	{exp = ex;}
		finally	{EndCase(exp); exp = null;}

		fc.ConstraintName  = "myConstraint";

		try
		{
			BeginCase("set/get ");
			Compare(fc.ConstraintName ,"myConstraint" );
		}
		catch(Exception ex)	{exp = ex;}
		finally	{EndCase(exp); exp = null;}
	}
Ejemplo n.º 4
1
 private void  button1_Click(object sender, EventArgs e)
 {
     
     bool check;
     Control.Control control= new Control.Control();
     Entity.Entity entity = new Entity.Entity();
     entity.setUsername(this.textBox1.Text);
     entity.setPassword(this.textBox2.Text);
     check = control.checkUsers(entity.getUsername(), entity.getPassword());
     dt = control.getCustomer(entity.getUsername());
     if (check)
     {
         check1 = true;
         mainForm main = new mainForm();
         main.ShowDialog();
         this.textBox1.Text = "";
         this.textBox2.Text = "";
     }
     else {
         this.textBox1.Text = "";
         this.textBox2.Text = "";
         MessageBox.Show("密码错误或用户名不存在");
     }
     
 }
Ejemplo n.º 5
1
        public void resetData()
        {
            DataSet dstmp = new DataSet();
            //创建虚拟数据表
            DataTable table = new DataTable("TAB_NM");
            //获取列集合,添加列
            DataColumnCollection columns = table.Columns;
            columns.Add("教工号", typeof(String));
            columns.Add("姓名", typeof(String));
            columns.Add("基本工资", typeof(float));
            columns.Add("津贴", typeof(float));
            columns.Add("公积金", typeof(float));
            columns.Add("生活费", typeof(float));
            columns.Add("所得税", typeof(float));

            List<Teacher> list = new TeacherDB().selectAll();
            //Teacher mTeacher = new Teacher();
            foreach (Teacher mTeacher in list)
            {
                //添加一行记录
                DataRow row = table.NewRow();
                row["教工号"] = mTeacher.Id;
                row["姓名"] = mTeacher.Name;
                row["基本工资"] = mTeacher.BaseSalary;
                row["津贴"] = mTeacher.Allowance;
                row["公积金"] = mTeacher.Fund;
                row["生活费"] = mTeacher.Sanitary;
                row["所得税"] = mTeacher.IncomeTax;
                table.Rows.Add(row);

            }
            dstmp.Tables.Add(table); //把信息表放入DataSet中

            dataGridView1.DataSource = dstmp.Tables["TAB_NM"];
        }
Ejemplo n.º 6
1
 public void BindData()
 {
     DataSet searchList = new DataSet();
     StringBuilder builder = new StringBuilder();
     if (this.txtKeyword.Text.Trim() != "")
     {
         builder.Append(" NickName like '%" + this.txtKeyword.Text + "%' ");
     }
     if (!string.IsNullOrEmpty(this.txtBeginTime.Text.Trim()))
     {
         if (builder.Length > 0)
         {
             builder.Append(" and ");
         }
         builder.Append("  convert(date,User_dateCreate)>='" + this.txtBeginTime.Text.Trim() + "' ");
     }
     if (Globals.SafeInt(this.dropType.SelectedValue, -1) > -1)
     {
         if (builder.Length > 0)
         {
             builder.Append(" and ");
         }
         builder.Append("  Activity=" + this.dropType.SelectedValue + " ");
     }
     if (!string.IsNullOrEmpty(this.txtEndTime.Text.Trim()))
     {
         if (builder.Length > 0)
         {
             builder.Append(" and ");
         }
         builder.Append("  convert(date,User_dateCreate)<='" + this.txtEndTime.Text.Trim() + "' ");
     }
     searchList = this.user.GetSearchList("UU", builder.ToString());
     this.gridView.DataSetSource = searchList;
 }
Ejemplo n.º 7
1
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            SqlConnection con = new SqlConnection(constring);
            con.Open();

            int curRow = int.Parse(e.RowIndex.ToString());
            string currentrow;
            currentrow = dataGridView1.Rows[curRow].Cells[1].Value.ToString();

            SqlDataAdapter adp1 = new SqlDataAdapter("Select * from ResManagerToAdmin where ResID='" + currentrow + "'", con);
            DataSet ds1 = new DataSet();
            adp1.Fill(ds1);

            SqlCommand cmd = new SqlCommand("Update ResManagerToAdmin set RView='" + p2 + "' where ResID='" + currentrow + "'", con);
            cmd.ExecuteNonQuery();

            SqlCommand cmd1 = new SqlCommand("Update ResManagerToAdmin set RFinalView='" + p2 + "' where ResID='" + currentrow + "'", con);
            cmd1.ExecuteNonQuery();

            status = ds1.Tables[0].Rows[0]["RStatus"].ToString();

            if (status == "Success")
            {
                ViewAdminResponses var = new ViewAdminResponses();
                var.ShowDialog();
            }
            else
            {
                RecordNotFound rnf = new RecordNotFound();
                rnf.ShowDialog();
            }
        }
Ejemplo n.º 8
1
 public static List<string> QueryAccessFomList(int userID, string conn)
 {
     try
     {
         List<string> list = new List<string>();
         DataSet ds = new DataSet();
         ds.Tables.Add();
         ds.Tables[0].Columns.Add("mode");
         ds.Tables[0].Columns.Add("id");
         ds.Tables[0].Rows.Add("2", userID);
         DataTable dt = DbUserRes.QueryFormAuth(ds, conn);
         if (dt != null && dt.Rows.Count > 0)
         {
             for (int i = 0; i < dt.Rows.Count; i++)
             {
                 string formName = dt.Rows[i]["NAME"].ToString();
                 if (!list.Contains(formName))
                 {
                     list.Add(formName);
                 }
             }
         }
         return list;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 9
1
        /// <summary>
        /// 处理数据
        /// </summary>
        /// <param name="ds"></param>
        public void HandleData(DataSet ds)
        {
            int count = ds.Tables[0].Rows.Count;
            int current = AspNetPager.PageSize * (AspNetPager.CurrentPageIndex - 1) + 1;

            dsPosts.Tables.Add("table");
            dsPosts.Tables[0].Columns.AddRange(new DataColumn[] {
                new DataColumn("ID"),
                new DataColumn("PostTitle"),
                new DataColumn("PosterID"),
                new DataColumn("PostContent"),
                new DataColumn("PostRecordTime"),
                new DataColumn("PostReplyCount"),
                new DataColumn("PosterType"),
                new DataColumn("PostPlateID"),
                new DataColumn("ViewTimes")
            });

            DataRow row;
            for (int i = current - 1; (i < current + AspNetPager.PageSize - 1) && (i < count); i++)
            {
                row = ds.Tables[0].Rows[i];

                dsPosts.Tables[0].Rows.Add(row["ID"], row["PostTitle"], row["PosterID"], row["PostContent"], row["PostRecordTime"],
                    row["PostReplyCount"], row["PosterType"], row["PostPlateID"], row["ViewTimes"]);
            }
        }
Ejemplo n.º 10
1
 public SquadForm(DbConnect postgreConnect, DataSet globalDS, int squadID = -1)
 {
     InitializeComponent();
     cbColumn = new DataGridViewCheckBoxColumn();
     cbColumn.HeaderText = "Является сотрудником отряда";
     cbColumn.DataPropertyName = "is_in_squad";
     cbColumn.FillWeight = 40;
     cbColumn.ReadOnly = false;
     dataSet1 = globalDS;
     postgreConnection = postgreConnect;
     squadSelectBS.DataSource = dataSet1.Tables["squad"];
     listBox1.DataSource = dataSet1.Tables["squad"];
     listBox1.DisplayMember = "name";
     listBox1.ValueMember = "id";
     initEnd = true;
     if (listBox1.SelectedValue != null)
         ChangeSelectedSquad(int.Parse(listBox1.SelectedValue.ToString()));
     else
         DeactivateAllButtons();
     SetButtonPermissions();
     if (squadID != -1)
         listBox1.SelectedValue = squadID;
     bindingNavigator2.BindingSource = selectionsDataBS;
     bindingNavigator1.BindingSource = employeesAddBS;
     dataGridView1.DataSource = selectionsDataBS;
 }
Ejemplo n.º 11
1
        public IList<Models.Auto> GetAllAutos()
        {
            DataSet ds = new DataSet();

            myCommand = new SqlDataAdapter("Select * from Auto", myConnection);

            ds = new DataSet();

            myCommand.Fill(ds);

            IList<Models.Auto> AutoList = new List<Models.Auto>();

            foreach (DataRow item in ds.Tables[0].Rows)
            {
                AutoList.Add(new Auto
                {
                    AutoNumber = item["AutoNumber"].ToString(),
                    AutoName = item["AutoName"].ToString()
                });
            }

            ds.Dispose();
            ds = null;

            return AutoList;
        }
Ejemplo n.º 12
1
        private void ArrayBinding_Load(object sender, System.EventArgs e)
        {
            // Access database
            System.Windows.Forms.DataVisualization.Charting.Utilities.SampleMain.MainForm mainForm = (System.Windows.Forms.DataVisualization.Charting.Utilities.SampleMain.MainForm)this.ParentForm;

            // The XML document
            string fileNameString = mainForm.applicationPath + "\\data\\data.xml";
            string fileNameSchema = mainForm.applicationPath + "\\data\\data.xsd";

            // Initializes a new instance of the DataSet class
            DataSet custDS = new DataSet();

            // Reads an XML schema into the DataSet.
            custDS.ReadXmlSchema( fileNameSchema );

            // Reads XML schema and data into the DataSet.
            custDS.ReadXml( fileNameString );

            // Initializes a new instance of the DataView class
            DataView firstView = new DataView(custDS.Tables[0]);

            Chart1.Series.Clear();
            // Since the DataView implements and IEnumerable, pass the reader directly into
            // the DataBindTable method with the name of the column used for the X value.
            Chart1.DataBindTable(firstView, "Name");

            // Set series appearance
            Chart1.Series[0].ChartType = SeriesChartType.Bar;
            Chart1.Series[0].Font = new Font("Trebuchet MS", 8);
            Chart1.Series[0].Color = System.Drawing.Color.FromArgb(220, 224,64,10);
            Chart1.Series[0].BorderWidth = 0;
        }
Ejemplo n.º 13
1
 public void LoadData()
 {
     ds = BWorkstation.Retrieves();
     dgrWorkstation.AutoGenerateColumns = false;
     dgrWorkstation.DataSource = ds.Tables[0].DefaultView;
     GenSTT();
 }
Ejemplo n.º 14
1
        public static string runDocno(string tablename, string fieldname, string doctype)
        {

            SqlConnection con = new SqlConnection(SysApp.DatabaseConfig.ServerConStr);

            string sql = " select ";
            sql += " case when max(substring(" + fieldname + ",4,6)) <> convert(varchar,getdate(),12) then ";
            sql += " '" + doctype + "' + convert(varchar,getdate(),12) + '-0001' ";
            sql += " when max(substring(" + fieldname + ",4,6)) = convert(varchar,getdate(),12) then ";
            sql += " case ";
            sql += " when (select max(substring(" + fieldname + ",11,4))+1 from " + tablename + " where substring(" + fieldname + ",4,6) = convert(varchar,getdate(),12) and " + fieldname + " like '" + doctype + "%') <10 then '" + doctype + "' + convert(varchar,getdate(),12) + '-000' + convert(varchar,(select max(substring(" + fieldname + ",11,4))+1 from " + tablename + " where substring(" + fieldname + ",4,6) = convert(varchar,getdate(),12) and " + fieldname + " like '" + doctype + "%')) ";
            sql += " when (select max(substring(" + fieldname + ",11,4))+1 from " + tablename + " where substring(" + fieldname + ",4,6) = convert(varchar,getdate(),12) and " + fieldname + " like '" + doctype + "%') <100 then '" + doctype + "' + convert(varchar,getdate(),12) + '-00' + convert(varchar,(select max(substring(" + fieldname + ",11,4))+1 from " + tablename + " where substring(" + fieldname + ",4,6) = convert(varchar,getdate(),12) and " + fieldname + " like '" + doctype + "%')) ";
            sql += " when (select max(substring(" + fieldname + ",11,4))+1 from " + tablename + " where substring(" + fieldname + ",4,6) = convert(varchar,getdate(),12) and " + fieldname + " like '" + doctype + "%') <1000 then '" + doctype + "' + convert(varchar,getdate(),12) + '-0' + convert(varchar,(select max(substring(" + fieldname + ",11,4))+1 from " + tablename + " where substring(" + fieldname + ",4,6) = convert(varchar,getdate(),12) and " + fieldname + " like '" + doctype + "%')) ";
            sql += " else ";
            sql += " '" + doctype + "' + convert(varchar,getdate(),12) + '-' + convert(varchar,(select max(substring(" + fieldname + ",11,4))+1 from " + tablename + " where substring(" + fieldname + ",4,6) = convert(varchar,getdate(),12) and " + fieldname + " like '" + doctype + "%')) ";
            sql += " end ";
            sql += " else ";
            sql += " '" + doctype + "' + convert(varchar,getdate(),12) + '-0001' ";
            sql += " end ";
            sql += " as " + fieldname;
            sql += " from " + tablename;
            sql += " where " + fieldname + " like '" + doctype + "%' ";

            SqlDataAdapter da = new SqlDataAdapter(sql, con);
            DataSet ds = new DataSet();
            da.Fill(ds, "runDocno");
            string docno = ds.Tables["runDocno"].Rows[0][fieldname].ToString();
            da = null;
            return docno;
        }
Ejemplo n.º 15
1
        private void cartelera_Load(object sender, EventArgs e)
        {
            //frmCiudad ciudad = new frmCiudad();
            String numeroSucursal = lblsucursal.Text;

            string query = string.Format("select TRHORA.idSucursal,MAPELI.iidpelicula, MAPELI.bimagen FROM TRHORARIO TRHORA, MAPELICULA MAPELI WHERE TRHORA.iidpelicula=MAPELI.iidpelicula and TRHORA.idSucursal = '"+ numeroSucursal +"'");
            MySqlCommand comando = new MySqlCommand(query, classCrearConexion.Conexion());
            MySqlDataAdapter da = new MySqlDataAdapter(comando);
            DataSet ds = new DataSet("MAPELICULA");
            da.Fill(ds, "MAPELICULA");
            byte[] datos = new byte[0];
            DataRow dr = ds.Tables["MAPELICULA"].Rows[0];
            datos = (byte[])dr["bimagen"];
            System.IO.MemoryStream ms = new System.IO.MemoryStream(datos);
            pb1.Image = System.Drawing.Bitmap.FromStream(ms);
            /*pb1.Image = Properties.Resources.El_Destino_de_Júpite;
            pb1.Refresh();
            pb2.Image = Properties.Resources.FF2;
            pb2.Refresh();
            pb3.Image = Properties.Resources.In_to_the_Woods_En_el_Bosqu;
            pb3.Refresh();
            pb4.Image = Properties.Resources.Ombis_Alien_Invasion__2015_;
            pb4.Refresh();
            pb5.Image = Properties.Resources.peliculas_2015_15_e1422754101215;
            pb5.Refresh();
            pb6.Image = Properties.Resources.peliculas_2015_rapido_furioso_4;
            pb6.Refresh();
            pb7.Image = Properties.Resources.images;
            pb7.Refresh();*/
        }
Ejemplo n.º 16
1
        public bool InsertUpdateDelete(DataSet ds)
        {
            Database db = DatabaseFactory.CreateDatabase(Constants.HBMCONNECTIONSTRING);
            DbCommand commandInsert = db.GetStoredProcCommand("usp_TaxTypeInsert");

            db.AddInParameter(commandInsert, "@CompanyId", DbType.Int32, "CompanyId", DataRowVersion.Current);
            db.AddInParameter(commandInsert, "@TaxTypeName", DbType.String, "TaxTypeName", DataRowVersion.Current);
            db.AddInParameter(commandInsert, "@Note", DbType.String, "Note", DataRowVersion.Current);
            db.AddInParameter(commandInsert, "@TaxPercentage", DbType.Decimal, "TaxPercentage", DataRowVersion.Current);

            db.AddInParameter(commandInsert, "@CreatedUser", DbType.Int32, "CreatedUser", DataRowVersion.Current);
            db.AddInParameter(commandInsert, "@StatusId", DbType.Int32, "StatusId", DataRowVersion.Current);

            DbCommand commandUpdate = db.GetStoredProcCommand("usp_TaxTypeUpdate");
            db.AddInParameter(commandUpdate, "@TaxTypeId", DbType.Int32, "TaxTypeId", DataRowVersion.Current);
            db.AddInParameter(commandUpdate, "@TaxTypeName", DbType.String, "TaxTypeName", DataRowVersion.Current);
            db.AddInParameter(commandUpdate, "@Note", DbType.String, "Note", DataRowVersion.Current);
            db.AddInParameter(commandUpdate, "@TaxPercentage", DbType.Decimal, "TaxPercentage", DataRowVersion.Current);

            db.AddInParameter(commandUpdate, "@UpdatedUser", DbType.Int32, "UpdatedUser", DataRowVersion.Current);
            db.AddInParameter(commandUpdate, "@StatusId", DbType.Int32, "StatusId", DataRowVersion.Current);

            DbCommand commandDelete = db.GetStoredProcCommand("usp_TaxTypeDelete");
            db.AddInParameter(commandDelete, "@TaxTypeId", DbType.Int32, "TaxTypeId", DataRowVersion.Current);

            db.UpdateDataSet(ds, ds.Tables[0].TableName, commandInsert, commandUpdate, commandDelete, UpdateBehavior.Transactional);

            return true;
        }
 public DataSet GetAll(string empresaid, tb_co_tabla01_mediopago BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbCoTabla01Mediopago_SEARCH", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandTimeout = 0;
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@codigoid", SqlDbType.Char, 3).Value = BE.codigoid;
                 cmd.Parameters.Add("@descripcion", SqlDbType.VarChar, 100).Value = BE.descripcion;
                 cmd.Parameters.Add("@sigla", SqlDbType.Char, 3).Value = BE.sigla;
                 cmd.Parameters.Add("@usuar", SqlDbType.Char, 15).Value = BE.usuar;
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            DataSet ds = new DataSet();
            DataSet ds1 = new DataSet();
            ds.ReadXml(@"D:\Books.xml");

            bookgrd.DataSource = ds.Tables[0];
            bookgrd.DataBind();

            IEnumerable<DataRow> tbl1row = ds.Tables[0].AsEnumerable();
            ds1.ReadXml(@"D:\Books2.xml");

            IEnumerable<DataRow> tbl2row = ds1.Tables[0].AsEnumerable();
            GridView1.DataSource = ds1.Tables[0];
            GridView1.DataBind();

            var items = tbl2row.AsEnumerable().Select(r => r.Field<string>("id"))
            .Except(tbl1row.AsEnumerable().Select(r => r.Field<string>("id")));

            DataTable TableC = (from row in tbl2row.AsEnumerable()
                                join id in items
                                on row.Field<string>("id") equals id
                                select row).CopyToDataTable();

            GridView2.DataSource = TableC;
            GridView2.DataBind();
        }
        protected void load_price()
        {
            string price_name = null;
            string article = null;
            price_name = Request.QueryString["price_name"];
            article = Request.QueryString["article"];

            if (article != null)
            {
                if (price_name != null)
                {

                    SqlConnection con = new SqlConnection(str);
                    string sql = "SELECT id, article, ROUND([price]*(SELECT course FROM Course_USD WHERE id = 1),2) AS [price] FROM " + price_name + " WHERE article=" + article + ";";
                    SqlDataAdapter da = new SqlDataAdapter(sql, con);
                    DataSet ds = new DataSet();
                    da.Fill(ds, price_name);
                    DataRow dr;
                    dr = ds.Tables[price_name].Rows[0];

                    //Заполняем стоимость товара:
                    lblprice.Text = dr["price"].ToString();
                }
                else {Response.Redirect("Error.aspx");}

            }
            else {Response.Redirect("Error.aspx"); }
        }
Ejemplo n.º 20
1
        public DataSet FilterData(ArsonFilterModel filterData)
        {
            var connectionString = ConfigurationManager.ConnectionStrings["UCR_DataEntities"];
            DataSet dsResult = new DataSet();
            using (SqlConnection conn = new SqlConnection(connectionString.ConnectionString))
            {
                try
                {
                    SqlCommand command = new SqlCommand();
                    command.Connection = conn;
                    command.CommandText = GenerateArsonORQuery(filterData);
                    command.CommandType = System.Data.CommandType.Text;
                    SqlDataAdapter adapter = new SqlDataAdapter();
                    adapter.SelectCommand = command;

                    conn.Open();
                    adapter.Fill(dsResult);
                    conn.Close();
                    adapter.Dispose();
                    command.Dispose();
                }
                catch (Exception ex)
                {
                    StorageClient.LogError(ex);
                }
            }
            return dsResult;
        }
Ejemplo n.º 21
1
        /// <summary>
        /// 根据faterid 获取组织机构树
        /// </summary>
        /// <returns></returns>
        public DataSet GetORGTreeByID(Dbconn conn, String strType)
        {
            DataSet ds = new DataSet();
            String strSQL = "";

            //获取条件值
            string strXML = m_request.Tables[0].Rows[0]["XML"].ToString();
            DataSet dsXML = Common.Common.GetDSByExcelXML(strXML);
            string strPage = dsXML.Tables["LIST"].Rows[0]["Page"].ToString();
            string strNum = dsXML.Tables["LIST"].Rows[0]["Num"].ToString();
            string strCons = dsXML.Tables["LIST"].Rows[0]["Cons"].ToString();
            string strOrderBy = dsXML.Tables["LIST"].Rows[0]["OrderBy"].ToString();
            string[] strParam = new string[] { };
            strSQL = @" SELECT [OZ1_OrgCode], [OZ1_OrgName], [OZ1_FatherId]
                        , [OZ1_OrgType], [OZ1_ID], [OZ1_CONO], [OZ1_DIVI], [OZ1_FatherId] As [OZ1_FatherIdT]
                        , [OZ1_CostCenterCode], [OZ1_DepartmentManager]
                        , [OZ1_MDeptCode], [OZ1_ShopCode], [OZ1_OrgEnable]
                        , [OZ1_CostCenterEnable], [OZ1_BusdepartmentEnable]
                        , [OZ1_ShopEnable], [OZ1_State], [OZ1_ModelType], [OZ1_BMMoney] 
                        , [OZ1_Brand], [OZ1_Com], [OZ1_CostCenterCode1], [OZ1_BMPer]
                        , OZ1_Com1, OZ1_ComCode1, OZ1_ISBranch, OZ1_CostCenterCode2
                        FROM [F01_CERT].[OZ1_Organization] 
                            WHERE 1=1  AND OZ1_OrgType <> '业务线' " + strCons + strOrderBy;
            ds = conn.GetDataSet(strSQL);
            return ds;
        }
Ejemplo n.º 22
1
        private void button1_Click_1(object sender, EventArgs e)
        {
            SqlConnection con1 = new SqlConnection(constring);
            con1.Open();
            SqlDataAdapter adp = new SqlDataAdapter("Select whoislogin from Registration", con1);
            DataSet ds = new DataSet();
            adp.Fill(ds);
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                SqlCommand cmd = new SqlCommand("Update Registration set whoislogin='******'", con1);
                cmd.ExecuteNonQuery();
            }

            SqlDataAdapter adp2 = new SqlDataAdapter("Select * from ResManagerToAdmin", con1);
            DataSet ds2 = new DataSet();
            adp2.Fill(ds2);
            for (int j = 0; j < ds2.Tables[0].Rows.Count; j++)
            {
                //adminview = ds.Tables[0].Rows[j]["RView"].ToString();
                SqlCommand cmd = new SqlCommand("Update ResManagerToAdmin set RView='" + adminviewempty + "'", con1);
                cmd.ExecuteNonQuery();
            }

            con1.Close();
            this.Close();
        }
Ejemplo n.º 23
1
        public static DataSet ExecuteDataSet(CommandType cmdType, string strProcedureName, SqlParameter[] objParameters)
        {
            DataSet dset = new DataSet();
            SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["db1ConnectionString"].ToString());
            con.Open();
            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.Connection = con;
                cmd.CommandType = cmdType;
                cmd.CommandText = strProcedureName;

                AttachParameters(cmd, objParameters);

                SqlDataAdapter ad = new SqlDataAdapter(cmd);
                ad.Fill(dset);

                return dset;

            }
            catch (Exception ex)
            {
                return dset;
            }
            finally
            {
                con.Close();
            }
        }
Ejemplo n.º 24
0
        public UserAction GetUserDetails(string UserName)
        {
            try
            {
                oDatabaseHandler = new DatabaseHandler();
                DataSet oDataSet = new DataSet();
                oDataSet = oDatabaseHandler.FillData("select U.UserId,U.RoleId,R.[Role] RoleName,R.[Create],R.Edit,R.[View],R.Assign,R.Finish from Users as U "
                                                     + " inner join Roles R on R.RoleId=U.RoleId"
                                                     + " where U.UserName='******'");

                if (oDataSet != null && oDataSet.Tables != null && oDataSet.Tables.Count > 0 && oDataSet.Tables[0].Rows != null && oDataSet.Tables[0].Rows.Count > 0)
                {
                    UserAction oUserDetails = new UserAction();
                    //oUserDetails.Cus = int.Parse(oDataSet.Tables[0].Rows[0]["UserId"].ToString());
                    oUserDetails.UserName = UserName;// oDataSet.Tables[0].Rows[0]["UserId"].ToString();
                    oUserDetails.RoleID = int.Parse(oDataSet.Tables[0].Rows[0]["RoleId"].ToString());

                    oUserDetails.RoleName = oDataSet.Tables[0].Rows[0]["RoleName"].ToString();
                    oUserDetails.Create = bool.Parse(oDataSet.Tables[0].Rows[0]["Create"].ToString());
                    oUserDetails.Edit = bool.Parse(oDataSet.Tables[0].Rows[0]["Edit"].ToString());
                    oUserDetails.View = bool.Parse(oDataSet.Tables[0].Rows[0]["View"].ToString());
                    oUserDetails.Assign = bool.Parse(oDataSet.Tables[0].Rows[0]["Assign"].ToString());
                    oUserDetails.Finish = bool.Parse(oDataSet.Tables[0].Rows[0]["Finish"].ToString());

                    return oUserDetails;
                }
                return null;
            }
            catch (Exception ex)
            {

            }
            return null;
        }
Ejemplo n.º 25
0
        private void BindData()
        {
            SqlDataSource1.DataBind();
            //string sqlquery = "SELECT * FROM [ISBEPI_DEV].[dbo].[HomeVisitorSiteVisitSurvey] WHERE Schd_ID = 16";
            DataTable dt = new DataTable();
            DataSourceSelectArguments args = new DataSourceSelectArguments();
            DataView view = (DataView)SqlDataSource1.Select(args);
            dt = view.ToTable();
            DataSet ds = new DataSet();
            ds.Tables.Add(dt);
            DataSet new_ds = FlipDataSet(ds); // Flip the DataSet
            DataView my_DataView = new_ds.Tables[0].DefaultView;
            this.DataGrid1.DataSource = my_DataView;
            this.DataGrid1.DataBind();

            DataTable dt2 = new DataTable();
            DataSourceSelectArguments args2 = new DataSourceSelectArguments();
            DataView view2 = (DataView)SqlDataSource2.Select(args2);
            dt2 = view2.ToTable();
            DataSet ds2 = new DataSet();
            ds2.Tables.Add(dt2);
            DataSet new_ds2 = FlipDataSet(ds2); // Flip the DataSet
            DataView my_DataView2 = new_ds2.Tables[0].DefaultView;
            this.DataGrid2.DataSource = my_DataView2;
            this.DataGrid2.DataBind();
        }
Ejemplo n.º 26
0
        public void process(ServiceRequest request, ServiceResponse response)
        {
            List<Category> list = new List<Category>();

            string sqlStr = "select * from category";

            MySqlConnection conn = ConnectionManager.getInstance().getConnection();

            conn.Open();

            MySqlDataAdapter mda = new MySqlDataAdapter(sqlStr, conn);
            DataSet ds = new DataSet();
            mda.Fill(ds,"table1");

            conn.Close();

            int count = ds.Tables["table1"].Rows.Count;
            for (int i = 0; i < count; i++)
            {
                Category c = new Category();
                c.categoryId = (int)ds.Tables["table1"].Rows[i][0];
                c.categoryName = (string)ds.Tables["table1"].Rows[i][1];
                list.Add(c);
            }

            GetCategoryResponse serviceResponse = new GetCategoryResponse();
            serviceResponse.categories = list;
            response.responseObj = serviceResponse;
            response.returnCode = 0;
        }
Ejemplo n.º 27
0
        public void challanout()
        {
            DataTable dt = new DataTable("challandt");
            dt = (DataTable)Session["challanout_dt"];

            DataSet ds = new DataSet();
            Viewer.Report.ChallanOutrpt crystalReport = new Report.ChallanOutrpt();
            string st = HttpContext.Current.Server.MapPath("~/ChallanOutCrpt1.rpt");

            //  Label1.Text = st;
            //   Response.Write(string.Format("<script language='javascript' type='text/javascript'>alert( "+st+") </script>"));

            crystalReport.Load(st);
            if (ds.Tables.Contains("challandt") == true)
            {
                ds.Tables.Remove("challandt");
            }
            ds.Tables.Add(dt);

            ds.WriteXmlSchema(HttpContext.Current.Server.MapPath("~/App_Data/Challanout.xml"));

            crystalReport.SetDataSource(dt);
            CrystalReportViewer1.ReportSource = crystalReport;

            crystalReport.ExportToHttpResponse
               (CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, true, "CHALLANOUTSHEET");
        }
Ejemplo n.º 28
0
 public DataSet GetAll(string empresaid, tb_tipimpto BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbTipimpto_SEARCH", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@tipimptoid", SqlDbType.Char, 1).Value = BE.tipimptoid;
                 cmd.Parameters.Add("@status", SqlDbType.Bit).Value = BE.status;
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }
Ejemplo n.º 29
0
        public DataSet FlipDataSet(DataSet my_DataSet)
        {
            DataSet ds = new DataSet();
            DataTable table = new DataTable();

            foreach (DataTable dt in my_DataSet.Tables)
            {

                for (int i = 0; i <= dt.Rows.Count; i++)
                {
                    table.Columns.Add(Convert.ToString(i));
                }

                for (int k = 0; k < dt.Columns.Count; k++)
                {
                    r = table.NewRow();
                    r[0] = dt.Columns[k].ToString();
                    for (int j = 1; j <= dt.Rows.Count; j++)
                        r[j] = dt.Rows[j - 1][k];
                    table.Rows.Add(r);
                }

                ds.Tables.Add(table);
            }

            return ds;
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Executes the query.
        /// </summary>
        /// <param name="dataSet">The data set to return containing the data.</param>
        /// <param name="tables">The datatable schema to add.</param>
        /// <param name="queryText">The query text to execute.</param>
        /// <param name="commandType">The command type.</param>
        /// <param name="connectionString">The connection string to use.</param>
        /// <param name="values">The collection of sql parameters to include.</param>
        /// <returns>The sql command containing any return values.</returns>
        public DbCommand ExecuteQuery(ref System.Data.DataSet dataSet, DataTable[] tables, string queryText,
                                      CommandType commandType, string connectionString, params DbParameter[] values)
        {
            // Initial connection objects.
            DbCommand dbCommand = null;

            OracleClient.OracleConnection orlConnection = null;
            IDataReader dataReader = null;

            try
            {
                // Create a new connection.
                using (orlConnection = new OracleClient.OracleConnection(connectionString))
                {
                    // Open the connection.
                    orlConnection.Open();

                    // Create the command and assign any parameters.
                    dbCommand = new OracleClient.OracleCommand(DataTypeConversion.GetSqlConversionDataTypeNoContainer(
                                                                   ConnectionContext.ConnectionDataType.OracleDataType, queryText), orlConnection);
                    dbCommand.CommandType = commandType;

                    if (values != null)
                    {
                        foreach (OracleClient.OracleParameter sqlParameter in values)
                        {
                            dbCommand.Parameters.Add(sqlParameter);
                        }
                    }

                    // Load the data into the table.
                    using (dataReader = dbCommand.ExecuteReader())
                    {
                        dataSet = new System.Data.DataSet();
                        dataSet.Tables.AddRange(tables);
                        dataSet.EnforceConstraints = false;
                        dataSet.Load(dataReader, LoadOption.OverwriteChanges, tables);
                        dataReader.Close();
                    }

                    // Close the database connection.
                    orlConnection.Close();
                }

                // Return the sql command, including
                // any parameters that have been
                // marked as output direction.
                return(dbCommand);
            }
            catch (Exception ex)
            {
                // Throw a general exception.
                throw new Exception(ex.Message, ex.InnerException);
            }
            finally
            {
                if (dataReader != null)
                {
                    dataReader.Close();
                }

                if (orlConnection != null)
                {
                    orlConnection.Close();
                }
            }
        }
Ejemplo n.º 31
0
    protected void remplirTableauBien(string idAcq)
    {
        //String requeteBien = "SELECT * FROM Biens INNER JOIN optionsBiens ON Biens.ref = optionsBiens.refOptions WHERE Biens.[ref]='" + idAcq + "'";
        String requeteBien = "SELECT * FROM Biens INNER JOIN optionsBiens ON Biens.ref = optionsBiens.refOptions WHERE Biens.[ref]='" + Request.QueryString["ref"] + "'";

        System.Data.DataSet dst = null;
        Connexion           c   = null;

        c = new Connexion(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
        c.Open();
        dst = c.exeRequette(requeteBien);
        c.Close();
        c = null;
        System.Data.DataRowCollection dsr = dst.Tables[0].Rows;

        Bien bien = new Bien();

        foreach (System.Data.DataRow ligne2 in dsr)
        {
            bien.REFERENCE        = ligne2["ref"].ToString();
            bien.ETAT             = ligne2["etat"].ToString();
            bien.TYPE_BIEN        = ligne2["type de bien"].ToString();
            bien.S_HABITABLE      = (int)ligne2["surface habitable"];
            bien.S_SEJOUR         = (int)ligne2["surface séjour"];
            bien.S_TERRAIN        = (int)ligne2["surface terrain"];
            bien.NBRE_PIECE       = (int)ligne2["nombre de pieces"];
            bien.NBRE_CHAMBRE     = (int)ligne2["nombre de chambres"];
            bien.CODE_POSTAL_BIEN = ligne2["code postal du bien"].ToString();
            bien.VILLE_BIEN       = ligne2["ville du bien"].ToString().ToUpper();
            bien.NEGOCIATEUR      = ligne2["negociateur"].ToString();
            bien.LOYER_CC         = (int)ligne2["loyer_cc"];
            bien.PRIX_VENTE       = (int)ligne2["prix de vente"];
            bien.PAYS             = ligne2["PaysBien"].ToString().ToUpper();
            bien.ADRESSE_BIEN     = ligne2["adresse du bien"].ToString();
            bien.ADRESSE_VENDEUR  = ligne2["adresse vendeur"].ToString();
            //bien.CODE_POSTAL_VENDEUR = int.Parse(ligne2["code postal vendeur"].ToString());
            bien.CODE_POSTAL_VENDEUR = ligne2["code postal vendeur"].ToString();
            bien.VILLE_VENDEUR       = ligne2["ville vendeur"].ToString();
            bien.PAYS_VENDEUR        = ligne2["pays vendeur"].ToString();
            bien.PRENOM_VENDEUR      = ligne2["prenom vendeur"].ToString();
            bien.NOM_VENDEUR         = ligne2["nom vendeur"].ToString();
        }

        int nbphotos = CheckNombrePhotos(bien.REFERENCE);

        switch (nbphotos)
        {
        case 0:
            LabelImage.Text = "<img style='width:125px;' src='../img_site/images_par_defaut/" + bien.TYPE_BIEN + ".jpg' alt='photo'>"
                              + "<div class='tooltip'><span>" + "<img style='width:250px' src='../img_site/images_par_defaut/" + bien.TYPE_BIEN + ".jpg' alt='photo'></span></div>";
            break;

        case 1:
            LabelImage.Text = "<img style='width:125px;' src='../images/" + bien.REFERENCE + "A.jpg' alt='photo'>"
                              + "<div class='tooltip'><span>" + nbphotos + " Photo <br/>" + "<img style='width:250px' src='../images/" + bien.REFERENCE + "A.jpg' alt='photo'></span></div>";
            break;

        default:
            LabelImage.Text = "<img style='width:125px;' src='../images/" + bien.REFERENCE + "A.jpg' alt='photo'>"
                              + "<div class='tooltip'><span>" + nbphotos + " Photos <br/>" + "<img style='width:250px;' src='../images/" + bien.REFERENCE + "A.jpg' alt='photo'> " + "<img style='margin-left:5px;width:250px;' src='../images/" + bien.REFERENCE + "B.jpg' alt='photo'></span></div>";
            break;
        }

        Label0.Text  = ": " + bien.REFERENCE;
        Label12.Text = "<a href=\"./fichedetail1.aspx?ref=" + bien.REFERENCE + "\" target='_blank'>Voir Fiche</a>";

        switch (bien.TYPE_BIEN)
        {
        case "A":
            Label2.Text = ": Appartement";
            break;

        case "M":
            Label2.Text = ": Maison";
            break;

        case "I":
            Label2.Text = ": Immeuble";
            break;

        case "L":
            Label2.Text = ": Local";
            break;

        case "T":
            Label2.Text = ": Terrain";
            break;
        }

        string codeiso = Code_iso("bieniso", bien);

        Label3.Text    = ": " + bien.S_HABITABLE.ToString();
        Label3bis.Text = ": " + bien.S_SEJOUR.ToString();
        Label4.Text    = ": " + bien.S_TERRAIN.ToString();
        Label5.Text    = ": " + bien.NBRE_PIECE.ToString();
        Label6.Text    = bien.CODE_POSTAL_BIEN + ", " + bien.VILLE_BIEN;
        Label7.Text    = ": " + "<img height='20px'  src='../img_site/drapeau/" + codeiso + ".png'/>" + "<div class='tooltip'><span>" + "<img height='50px'  src='../img_site/drapeau/" + codeiso + ".png'/></span></div>" + "&nbsp;" + "<a href='https://www.google.fr/maps/place/" + bien.ADRESSE_BIEN + " " + bien.VILLE_BIEN + "' target='_blank'><img style='cursor:pointer' src='../img_site/flat_round/monde.png' height='20px'/></a>" + " " + bien.ADRESSE_BIEN;

        if (bien.LOYER_CC == 0)
        {
            Label9.Text = ": " + bien.PRIX_VENTE.ToString();
        }
        else
        {
            Label9.Text = ": " + bien.LOYER_CC.ToString();
        }

        string temp = Label9.Text;
        string prix = "";
        int    k    = 0;

        while ((k + 1) * 3 < temp.Length)
        {
            prix = temp.Substring((temp.Length - (k + 1) * 3), 3) + " " + prix;
            k++;
        }
        prix = temp.Substring(0, temp.Length - k * 3) + " " + prix;

        Label9.Text = prix;

        codeiso = Code_iso("vendeur", bien, null);

        if (codeiso != "" && bien.ADRESSE_VENDEUR != "" && bien.VILLE_VENDEUR != "")
        {
            adressevendeur.Text = "<img height='20px'  src='../img_site/drapeau/" + codeiso + ".png'/>" + "<div class='tooltip'><span>" + "<img height='50px'  src='../img_site/drapeau/" + codeiso + ".png'/></span></div>" + "&nbsp;" + "<a href='https://www.google.fr/maps/place/" + bien.ADRESSE_VENDEUR + " " + bien.VILLE_VENDEUR + "' target='_blank'><img style='cursor:pointer' src='../img_site/flat_round/monde.png' height='20px'/></a>" + " " + bien.ADRESSE_VENDEUR + "<br/>&nbsp;&nbsp;" + bien.CODE_POSTAL_VENDEUR + ", " + bien.VILLE_VENDEUR;
        }
        else
        if (codeiso == "" || bien.VILLE_VENDEUR == "" || bien.ADRESSE_VENDEUR == "")
        {
            if (bien.ADRESSE_VENDEUR == "" || bien.VILLE_VENDEUR == "")
            {
                if (codeiso == "")
                {
                    adressevendeur.Text = bien.ADRESSE_VENDEUR + "<br/>&nbsp;&nbsp;" + bien.CODE_POSTAL_VENDEUR + bien.VILLE_VENDEUR;
                }
                else
                {
                    adressevendeur.Text = "<img height='20px'  src='../img_site/drapeau/" + codeiso + ".png'/>" + "<div class='tooltip'><span>" + "<img height='50px'  src='../img_site/drapeau/" + codeiso + ".png'/></span></div>" + "&nbsp;" + " " + bien.ADRESSE_VENDEUR + "<br/>&nbsp;&nbsp;" + bien.CODE_POSTAL_VENDEUR + bien.VILLE_VENDEUR;
                }
            }
            else
            {
                adressevendeur.Text = "<a href='https://www.google.fr/maps/place/" + bien.ADRESSE_VENDEUR + " " + bien.VILLE_VENDEUR + "' target='_blank'><img style='cursor:pointer' src='../img_site/flat_round/monde.png' height='20px'/></a>" + " " + bien.ADRESSE_VENDEUR + "<br/>&nbsp;&nbsp;" + bien.CODE_POSTAL_VENDEUR + bien.VILLE_VENDEUR;
            }
        }

        nomvendeur.Text = bien.NOM_VENDEUR + " " + bien.PRENOM_VENDEUR;
    }
Ejemplo n.º 32
0
        /// <summary>
        /// 高级查询
        /// </summary>
        /// <param name="ServerID">0珠海GPS1深圳GPS2珠海Customer</param>
        /// <param name="iPageIndex">页索引</param>
        /// <param name="iPageSize">每页显示记录数</param>
        /// <param name="strFields">要显示的字段列表</param>
        /// <param name="strFrom">要查询的表名</param>
        /// <param name="strWhere">查询条件</param>
        /// <param name="strOrderBy">排序字段</param>
        /// <param name="iRecordCount">总记录数</param>
        /// <param name="iPageCount">总页数</param>
        /// <param name="ds">DataSet控件ID</param>
        public bool DataSelect1(int iPageIndex, int iPageSize, string strFields, string strFrom,
                                string strWhere, string strOrderBy, out int iRecordCount, out int iPageCount, out System.Data.DataSet ds, out string strError)
        {
            iRecordCount = 0;
            iPageCount   = 0;
            ds           = new DataSet();
            strError     = string.Empty;
            bool result = false;

            SqlConnection myConn = new SqlConnection(m_strConnection);
            SqlCommand    myComm = new SqlCommand("prDefiPager1", myConn);

            myComm.CommandType = CommandType.StoredProcedure;

            SqlParameter PageIndex = new SqlParameter("@PageIndex", SqlDbType.Int, 20);//页索引

            PageIndex.Value = iPageIndex;
            myComm.Parameters.Add(PageIndex);

            SqlParameter PageSize = new SqlParameter("@PageSize", SqlDbType.Int, 20);//每页显示记录数

            PageSize.Value = iPageSize;
            myComm.Parameters.Add(PageSize);

            SqlParameter Fields = new SqlParameter("@Fields", SqlDbType.VarChar, 500);//要显示的字段列表

            Fields.Value = strFields;
            myComm.Parameters.Add(Fields);

            SqlParameter From = new SqlParameter("@From", SqlDbType.VarChar, 700);//要查询的表名

            From.Value = strFrom;
            myComm.Parameters.Add(From);

            SqlParameter Where = new SqlParameter("@Where", SqlDbType.VarChar, 500);//查询条件

            Where.Value = strWhere;
            myComm.Parameters.Add(Where);

            SqlParameter OrderBy = new SqlParameter("@OrderBy", SqlDbType.VarChar, 100);//排序字段

            OrderBy.Value = strOrderBy;
            myComm.Parameters.Add(OrderBy);

            SqlParameter RecordCount = new SqlParameter("@RecordCount", SqlDbType.Int);//总记录数

            RecordCount.Direction = ParameterDirection.Output;
            myComm.Parameters.Add(RecordCount);

            SqlParameter PageCount = new SqlParameter("@PageCount", SqlDbType.Int);//总页数

            PageCount.Direction = ParameterDirection.Output;
            myComm.Parameters.Add(PageCount);

            try
            {
                myConn.Open();
                SqlDataAdapter sda = new SqlDataAdapter();
                sda.SelectCommand = myComm;
                sda.Fill(ds);

                iRecordCount = (int)RecordCount.Value;
                iPageCount   = (int)PageCount.Value;
                result       = true;
            }
            catch (Exception ex)
            {
                strError = ex.Message;
            }
            return(result);
        }
Ejemplo n.º 33
0
        public static TestOutput CorrectColour(ForeGroundStrucuture[] foregorungRGB_CPU, BackGroundStrucuture[] BackgroundXYZ_CPU)
        {
            //rgb = System.Drawing.Color.FromArgb(69, 77, 217);
            //X = 0.0630982813175294;
            //Y = 0.616476271122916;
            //Z = 0.667048468232457;

            const int image_size = 960 * 540;

            //cuda intializer
            CudafyModule km = CudafyModule.TryDeserialize();

            if (km == null || !km.TryVerifyChecksums())
            {
                // km = CudafyTranslator.Cudafy((typeof(ForeGroundStrucuture)), (typeof(BackGroundStrucuture)), typeof(Color));
                km = CudafyTranslator.Cudafy((typeof(ProfileStrucuture)), (typeof(ForeGroundStrucuture)), (typeof(BackGroundStrucuture)), (typeof(SampleStructure)), typeof(snake));
                km.TrySerialize();
            }

            CudafyTranslator.GenerateDebug = true;
            // cuda or emulator
            GPGPU gpu = CudafyHost.GetDevice(CudafyModes.Target, CudafyModes.DeviceId);

            //GPGPU gpu = CudafyHost.GetDevice(eGPUType.Emulator);
            Console.WriteLine("Running quick correction using {0}", gpu.GetDeviceProperties(false).Name);
            gpu.LoadModule(km);

            ForeGroundStrucuture[] distance_CPU = new ForeGroundStrucuture[image_size];

            // allocate memory on the GPU for the bitmap (same size as ptr)
            #region
            DataTable profile = new DataTable();
            try
            {
                // add the csv bin file
                using (GenericParserAdapter parser = new GenericParserAdapter(@"C:\lev\STColorCorrection\Data\PROFILE\p3700.csv"))
                {
                    System.Data.DataSet dsResult = parser.GetDataSet();
                    profile = dsResult.Tables[0];
                }
            }
            catch (Exception ex)
            { Console.WriteLine(ex); }
            #endregion

            // allocate temp memory, initialize it, copy to constant memory on the GPU
            // L 0-21 A 0-41 B 0-45

            ProfileStrucuture[, ,] profiles_CPU = new ProfileStrucuture[21, 41, 45];
            SampleStructure[,] samples_CPU      = new SampleStructure[image_size, 6];

            //profile inicialization
            #region
            for (int indexL = 0; indexL < 21; indexL++)
            {
                for (int indexA = 0; indexA < 41; indexA++)
                {
                    for (int indexB = 0; indexB < 45; indexB++)
                    {
                        profiles_CPU[indexL, indexA, indexB].L        = indexL;
                        profiles_CPU[indexL, indexA, indexB].A        = indexA;
                        profiles_CPU[indexL, indexA, indexB].B        = indexB;
                        profiles_CPU[indexL, indexA, indexB].Given_R  = 0;
                        profiles_CPU[indexL, indexA, indexB].Given_G  = 0;
                        profiles_CPU[indexL, indexA, indexB].Given_B  = 0;
                        profiles_CPU[indexL, indexA, indexB].ML       = 0;
                        profiles_CPU[indexL, indexA, indexB].MA       = 0;
                        profiles_CPU[indexL, indexA, indexB].MB       = 0;
                        profiles_CPU[indexL, indexA, indexB].MX       = 0;
                        profiles_CPU[indexL, indexA, indexB].MY       = 0;
                        profiles_CPU[indexL, indexA, indexB].MZ       = 0;
                        profiles_CPU[indexL, indexA, indexB].distance = -1.0;
                        profiles_CPU[indexL, indexA, indexB].weight   = -1.0;

                        profiles_CPU[indexL, indexA, indexB].isempty = TRUE;
                        profiles_CPU[indexL, indexA, indexB].isMoreAccurateThanOrigin = FALSE;
                    }
                }
            }



            int lvalue, avalue, bvalue;
            try
            {
                for (int i = 1; i < profile.Rows.Count; i++)
                {
                    lvalue = Convert.ToInt32(profile.Rows[i][0].ToString());
                    avalue = Convert.ToInt32(profile.Rows[i][1].ToString());
                    bvalue = Convert.ToInt32(profile.Rows[i][2].ToString());

                    lvalue = (int)(lvalue * 0.2);
                    avalue = (int)(avalue * 0.2) + 20;
                    bvalue = (int)(bvalue * 0.2) + 22;

                    profiles_CPU[lvalue, avalue, bvalue].L = lvalue;
                    profiles_CPU[lvalue, avalue, bvalue].A = avalue;
                    profiles_CPU[lvalue, avalue, bvalue].B = bvalue;

                    profiles_CPU[lvalue, avalue, bvalue].Given_R = (byte)Convert.ToByte(profile.Rows[i][9].ToString());
                    profiles_CPU[lvalue, avalue, bvalue].Given_G = (byte)Convert.ToByte(profile.Rows[i][10].ToString());
                    profiles_CPU[lvalue, avalue, bvalue].Given_B = (byte)Convert.ToByte(profile.Rows[i][11].ToString());

                    profiles_CPU[lvalue, avalue, bvalue].ML = (double)Convert.ToDouble(profile.Rows[i][3].ToString());
                    profiles_CPU[lvalue, avalue, bvalue].MA = (double)Convert.ToDouble(profile.Rows[i][4].ToString());
                    profiles_CPU[lvalue, avalue, bvalue].MB = (double)Convert.ToDouble(profile.Rows[i][5].ToString());

                    profiles_CPU[lvalue, avalue, bvalue].MX = (double)Convert.ToDouble(profile.Rows[i][6].ToString());
                    profiles_CPU[lvalue, avalue, bvalue].MY = (double)Convert.ToDouble(profile.Rows[i][7].ToString());
                    profiles_CPU[lvalue, avalue, bvalue].MZ = (double)Convert.ToDouble(profile.Rows[i][8].ToString());


                    profiles_CPU[lvalue, avalue, bvalue].isempty = FALSE;
                }
            }
            catch (Exception ex)
            { Console.WriteLine(ex); }
            #endregion

            //grab the colors
            ProfileStrucuture[, ,] profile_GPU = gpu.CopyToDevice(profiles_CPU);
            SampleStructure[,] samples_GPU     = gpu.CopyToDevice(samples_CPU);

            //begin execution
            // capture the start time
            gpu.StartTimer();
            ForeGroundStrucuture[] foregorungRGB_GPU = gpu.CopyToDevice(foregorungRGB_CPU);
            BackGroundStrucuture[] BackgroundXYZ_GPU = gpu.CopyToDevice(BackgroundXYZ_CPU);

            //out put
            ForeGroundStrucuture[] distance_GPU = gpu.Allocate(distance_CPU);

            // generate a bitmap from our sphere data
            //Image size: 1024 x 768

            dim3 grids   = new dim3(24, 675);
            dim3 threads = new dim3(8, 4);

            //dim3 grids = new dim3(1, 1);
            //dim3 threads = new dim3(1, 1);

            //quick_correct
            //gpu.Launch(grids, threads, ((Action<GThread, ProfileStrucuture[, ,], ForeGroundStrucuture[], BackGroundStrucuture[], ProfileStrucuture[], SampleStructure[,]>)QuickCorr), profile_GPU, foregorungRGB_GPU, BackgroundXYZ_GPU, distance_GPU, samples_GPU);

            //quick correct - testing
            gpu.Launch(grids, threads, ((Action <GThread, ProfileStrucuture[, , ], ForeGroundStrucuture[], BackGroundStrucuture[], ForeGroundStrucuture[], SampleStructure[, ]>)Snake), profile_GPU, foregorungRGB_GPU, BackgroundXYZ_GPU, distance_GPU, samples_GPU);


            // copy our bitmap back from the GPU for display
            gpu.CopyFromDevice(distance_GPU, distance_CPU);


            // get stop time, and display the timing results
            double     elapsedTime = gpu.StopTimer();
            TestOutput to_return   = new TestOutput();
            to_return.output_image = distance_CPU;
            to_return.timeTaken    = elapsedTime;
            Console.WriteLine("Time to generate: {0} ms", elapsedTime);
            gpu.Free(foregorungRGB_GPU);
            gpu.Free(BackgroundXYZ_GPU);
            gpu.Free(distance_GPU);
            gpu.FreeAll();

            return(to_return);
        }
Ejemplo n.º 34
0
        protected override System.Data.DataSet CreateDataSource()
        {
            System.Data.DataSet dataSet = new System.Data.DataSet();

            DataTable empInfoTable = new DataTable("EmpInfo");
            DataTable payrollTable = new DataTable("Payment");

            dataSet.Tables.Add(empInfoTable);
            dataSet.Tables.Add(payrollTable);

            payrollTable.Columns.Add("EmpPayrollID", typeof(string));
            int firstDetailColumnPos = payrollTable.Columns.Count;


            empInfoTable.Columns.Add("Employee No.", typeof(string));
            empInfoTable.Columns.Add("EmpPayrollID", typeof(int));
            empInfoTable.Columns.Add("Employee Name", typeof(string));
            empInfoTable.Columns.Add("Alias", typeof(string));

            empInfoTable.Columns.Add("Company", typeof(string));
            DBFilter  hierarchyLevelFilter    = new DBFilter();
            Hashtable hierarchyLevelHashTable = new Hashtable();

            hierarchyLevelFilter.add("HLevelSeqNo", true);
            ArrayList hierarchyLevelList = EHierarchyLevel.db.select(dbConn, hierarchyLevelFilter);

            //***** Start 2013/11/22, Ricky So, Special handle display by staff level (not in hierarchy setting)
            if (intHierarchyLevelID == STAFF_LEVEL_ID)
            {
                hierarchyLevelGroupingFieldName = "Employee Name";
            }
            //***** End 2013/11/22, Ricky So, Special handle display by staff level (not in hierarchy setting)

            foreach (EHierarchyLevel hlevel in hierarchyLevelList)
            {
                if (hlevel.HLevelID.Equals(intHierarchyLevelID))
                {
                    hierarchyLevelGroupingFieldName = hlevel.HLevelDesc;
                }
                empInfoTable.Columns.Add(hlevel.HLevelDesc, typeof(string));
                hierarchyLevelHashTable.Add(hlevel.HLevelID, hlevel);
            }
            empInfoTable.Columns.Add("Payroll Group", typeof(string));

            empInfoTable.Columns.Add("Date Join", typeof(DateTime));
            empInfoTable.Columns.Add("Date Left", typeof(DateTime));
            empInfoTable.Columns.Add("Net Payable", typeof(double));
            empInfoTable.Columns.Add("MCEE", typeof(double));
            empInfoTable.Columns.Add("MCER", typeof(double));
            empInfoTable.Columns.Add("VCEE", typeof(double));
            empInfoTable.Columns.Add("VCER", typeof(double));
            empInfoTable.Columns.Add("PFundEE", typeof(double));
            empInfoTable.Columns.Add("PFundER", typeof(double));

            DBFilter payPeriodFilter = new DBFilter();

            if (!PeriodFrom.Ticks.Equals(0))
            {
                payPeriodFilter.add(new Match("PayPeriodTo", ">=", PeriodFrom));
            }
            if (!PeriodTo.Ticks.Equals(0))
            {
                payPeriodFilter.add(new Match("PayPeriodTo", "<=", PeriodTo));
            }


            ArrayList payPeriodList = EPayrollPeriod.db.select(dbConn, payPeriodFilter);

            if (payPeriodList.Count > 0)
            {
                // reset period
                PeriodFrom = new DateTime();
                PeriodTo   = new DateTime();
            }

            DBFilter m_userCompanyFilter = new DBFilter();

            m_userCompanyFilter.add(new Match("UserID", currentUser.UserID));

            DBFilter m_userRankFilter = new DBFilter();

            m_userRankFilter.add(new Match("UserID", currentUser.UserID));

            Hashtable m_userCompanyList = new Hashtable();

            foreach (EUserCompany m_userCompany in EUserCompany.db.select(dbConn, m_userCompanyFilter))
            {
                m_userCompanyList.Add(m_userCompany.CompanyID, m_userCompany.CompanyID);
            }

            Hashtable m_userRankList = new Hashtable();

            foreach (EUserRank m_userRank in EUserRank.db.select(dbConn, m_userRankFilter))
            {
                m_userRankList.Add(m_userRank.RankID, m_userRank.RankID);
            }

            int[] m_EmpIDList = new int[empList.Count];
            int   i           = 0;

            foreach (EEmpPersonalInfo m_info in empList)
            {
                m_EmpIDList[i] = m_info.EmpID;
                i++;
            }


            foreach (EPayrollPeriod payPeriod in payPeriodList)
            {
                if (PeriodFrom > payPeriod.PayPeriodFr || PeriodFrom.Ticks.Equals(0))
                {
                    PeriodFrom = payPeriod.PayPeriodFr;
                }
                if (PeriodTo < payPeriod.PayPeriodTo || PeriodTo.Ticks.Equals(0))
                {
                    PeriodTo = payPeriod.PayPeriodTo;
                }



                DBFilter empPayrollFilter = new DBFilter();
                empPayrollFilter.add(new Match("PayPeriodID", payPeriod.PayPeriodID));
                empPayrollFilter.add(new IN("EmpID", m_EmpIDList));
                ArrayList empPayrollList = EEmpPayroll.db.select(dbConn, empPayrollFilter);

                foreach (EEmpPayroll empPayroll in empPayrollList)
                {
                    EEmpPersonalInfo empInfo = new EEmpPersonalInfo();
                    empInfo.EmpID = empPayroll.EmpID;
                    EEmpPersonalInfo.db.select(dbConn, empInfo);

                    DataRow row        = empInfoTable.NewRow();
                    DataRow paymentRow = payrollTable.NewRow();

                    row["Employee No."]        = empInfo.EmpNo;
                    row["EmpPayrollID"]        = empPayroll.EmpPayrollID;
                    paymentRow["EmpPayrollID"] = empPayroll.EmpPayrollID;
                    row["Employee Name"]       = empInfo.EmpEngFullName;
                    row["Alias"] = empInfo.EmpAlias;

                    row["Date Join"] = empInfo.EmpDateOfJoin;
                    DBFilter empTerminationFilter = new DBFilter();
                    empTerminationFilter.add(new Match("EmpID", empInfo.EmpID));
                    ArrayList empTerminationList = EEmpTermination.db.select(dbConn, empTerminationFilter);
                    if (empTerminationList.Count > 0)
                    {
                        row["Date Left"] = ((EEmpTermination)empTerminationList[0]).EmpTermLastDate;
                    }

                    DBFilter empPosFilter = new DBFilter();

                    EEmpPositionInfo empPos = AppUtils.GetLastPositionInfo(dbConn, payPeriod.PayPeriodTo, empInfo.EmpID);
                    if (empPos != null)
                    {
                        if (!m_userCompanyList.Contains(empPos.CompanyID) || !m_userRankList.Contains(empPos.RankID))
                        {
                            continue;
                        }


                        ECompany company = new ECompany();
                        company.CompanyID = empPos.CompanyID;
                        if (ECompany.db.select(dbConn, company))
                        {
                            row["Company"] = company.CompanyName;
                        }

                        EPayrollGroup payrollGroup = new EPayrollGroup();
                        payrollGroup.PayGroupID = empPos.PayGroupID;
                        if (EPayrollGroup.db.select(dbConn, payrollGroup))
                        {
                            row["Payroll Group"] = payrollGroup.PayGroupDesc;
                        }
                        DBFilter empHierarchyFilter = new DBFilter();
                        empHierarchyFilter.add(new Match("EmpPosID", empPos.EmpPosID));
                        ArrayList empHierarchyList = EEmpHierarchy.db.select(dbConn, empHierarchyFilter);
                        foreach (EEmpHierarchy empHierarchy in empHierarchyList)
                        {
                            EHierarchyLevel hierarchyLevel = (EHierarchyLevel)hierarchyLevelHashTable[empHierarchy.HLevelID];
                            if (hierarchyLevel != null)
                            {
                                EHierarchyElement hierarchyElement = new EHierarchyElement();
                                hierarchyElement.HElementID = empHierarchy.HElementID;
                                if (EHierarchyElement.db.select(dbConn, hierarchyElement))
                                {
                                    row[hierarchyLevel.HLevelDesc] = hierarchyElement.HElementDesc;
                                }
                            }
                        }
                    }


                    double netAmount = 0, releventIncome = 0, nonRelevantIncome = 0, MCEE = 0, MCER = 0, VCEE = 0, VCER = 0, PFUNDEE = 0, PFUNDER = 0;

                    DBFilter paymentRecordFilter = new DBFilter();
                    paymentRecordFilter.add(new Match("EmpPayrollID", empPayroll.EmpPayrollID));
                    paymentRecordFilter.add(new Match("PayRecStatus", "A"));
                    ArrayList paymentRecords = EPaymentRecord.db.select(dbConn, paymentRecordFilter);

                    foreach (EPaymentRecord paymentRecord in paymentRecords)
                    {
                        EPaymentCode payCode = new EPaymentCode();
                        payCode.PaymentCodeID = paymentRecord.PaymentCodeID;
                        EPaymentCode.db.select(dbConn, payCode);
                        string fieldName = payCode.PaymentCodeDesc;
                        if (payrollTable.Columns[fieldName] == null)
                        {
                            payrollTable.Columns.Add(new DataColumn(fieldName, typeof(double)));
                        }
                        if (paymentRow[fieldName] == null || paymentRow[fieldName] == DBNull.Value)
                        {
                            paymentRow[fieldName] = 0;
                        }
                        paymentRow[fieldName] = (double)paymentRow[fieldName] + paymentRecord.PayRecActAmount;


                        netAmount += paymentRecord.PayRecActAmount;
                        if (payCode.PaymentCodeIsMPF)
                        {
                            releventIncome += paymentRecord.PayRecActAmount;
                        }
                        else
                        {
                            nonRelevantIncome += paymentRecord.PayRecActAmount;
                        }
                    }

                    row["Net Payable"] = HROne.CommonLib.GenericRoundingFunctions.RoundingTo(netAmount, ExchangeCurrency.DefaultCurrencyDecimalPlaces(), ExchangeCurrency.DefaultCurrencyDecimalPlaces());
                    //row["Relevant Income"] = HROne.CommonLib.GenericRoundingFunctions.RoundingTo(releventIncome, ExchangeCurrency.DefaultCurrencyDecimalPlaces(), ExchangeCurrency.DefaultCurrencyDecimalPlaces());
                    //row["Non-Relevant Income"] = HROne.CommonLib.GenericRoundingFunctions.RoundingTo(nonRelevantIncome, ExchangeCurrency.DefaultCurrencyDecimalPlaces(), ExchangeCurrency.DefaultCurrencyDecimalPlaces());

                    DBFilter mpfRecordFilter = new DBFilter();
                    mpfRecordFilter.add(new Match("EmpPayrollID", empPayroll.EmpPayrollID));
                    ArrayList mpfRecords = EMPFRecord.db.select(dbConn, mpfRecordFilter);
                    foreach (EMPFRecord mpfRecord in mpfRecords)
                    {
                        VCER += mpfRecord.MPFRecActVCER;
                        MCER += mpfRecord.MPFRecActMCER;
                        VCEE += mpfRecord.MPFRecActVCEE;
                        MCEE += mpfRecord.MPFRecActMCEE;
                    }
                    row["MCEE"] = MCEE;
                    row["VCEE"] = VCEE;
                    row["MCER"] = MCER;
                    row["VCER"] = VCER;
                    ArrayList orsoRecords = EORSORecord.db.select(dbConn, mpfRecordFilter);
                    foreach (EORSORecord orsoRecord in orsoRecords)
                    {
                        PFUNDER += orsoRecord.ORSORecActER;
                        PFUNDEE += orsoRecord.ORSORecActEE;
                    }
                    row["PFundEE"] = PFUNDEE;
                    row["PFundER"] = PFUNDER;

                    empInfoTable.Rows.Add(row);
                    payrollTable.Rows.Add(paymentRow);
                }
            }
            DBFilter paymentCodeFilter = new DBFilter();

            paymentCodeFilter.add("PaymentCodeDisplaySeqNo", false);
            paymentCodeFilter.add("PaymentCode", false);
            ArrayList paymentCodeList = EPaymentCode.db.select(dbConn, paymentCodeFilter);

            foreach (EPaymentCode paymentCode in paymentCodeList)
            {
                if (payrollTable.Columns.Contains(paymentCode.PaymentCodeDesc))
                {
                    payrollTable.Columns[paymentCode.PaymentCodeDesc].SetOrdinal(firstDetailColumnPos);
                }
            }
            return(dataSet);
        }
Ejemplo n.º 35
0
        protected ushort GenerateColumnHeader(NPOI.HSSF.UserModel.HSSFSheet workSheet, System.Data.DataSet dataSet, string CompanyHeader, string HierarchyHeader, ushort RowPos, NPOI.HSSF.UserModel.HSSFCellStyle GroupHeaderStyle, NPOI.HSSF.UserModel.HSSFCellStyle ColumnHeaderStyle)
        {
            DataTable paymentTable = dataSet.Tables["payment"];

            //org.in2bits.MyXls.XF xf = xlsDoc.NewXF();
            //xf.Font.Bold = true;
            //xf.BottomLineStyle = (ushort)1;

            RowPos += 2;
            //workSheet.Cells.Add((int)RowPos, 1, "Company");
            //workSheet.Cells.Add((int)RowPos, 2, CompanyHeader);
            //workSheet.Rows[RowPos].GetCell(1).Font.Bold = true;
            //workSheet.Rows[RowPos].GetCell(2).Font.Bold = true;

            NPOI.HSSF.UserModel.HSSFRow  row  = (NPOI.HSSF.UserModel.HSSFRow)workSheet.CreateRow((int)RowPos);
            NPOI.HSSF.UserModel.HSSFCell cell = (NPOI.HSSF.UserModel.HSSFCell)row.CreateCell(0);
            cell.SetCellValue("Company");
            cell.CellStyle = GroupHeaderStyle;
            cell           = (NPOI.HSSF.UserModel.HSSFCell)row.CreateCell(1);
            cell.SetCellValue(CompanyHeader);
            cell.CellStyle = GroupHeaderStyle;

            RowPos += 2;
            //workSheet.Cells.Add((int)RowPos, 1, HierarchyHeader, xf);
            row = (NPOI.HSSF.UserModel.HSSFRow)workSheet.CreateRow((int)RowPos);

            ushort colPos = 0;

            // ***** Start 2013/11/22, Ricky So, grouping for Staff where Employee No is necessary
            if (intHierarchyLevelID == STAFF_LEVEL_ID)
            {
                cell = (NPOI.HSSF.UserModel.HSSFCell)row.CreateCell(colPos);
                cell.SetCellValue("Employee No.");
                cell.CellStyle = ColumnHeaderStyle;
                colPos++;
            }
            // ***** End 2013/11/22, Ricky So, grouping for Staff where Employee No is necessary

            cell = (NPOI.HSSF.UserModel.HSSFCell)row.CreateCell(colPos);
            cell.SetCellValue(HierarchyHeader);
            cell.CellStyle = ColumnHeaderStyle;

            foreach (DataColumn column in paymentTable.Columns)
            {
                if (column.ColumnName.Equals("EmpPayrollID"))
                {
                    continue;
                }
                colPos++;
                //workSheet.Cells.Add(RowPos, colPos, column.ColumnName, xf);
                cell = (NPOI.HSSF.UserModel.HSSFCell)row.CreateCell(colPos);
                cell.SetCellValue(column.ColumnName);
                cell.CellStyle = ColumnHeaderStyle;
            }
            colPos++;
            //workSheet.Cells.Add(RowPos, colPos, "Net Pay", xf);
            cell = (NPOI.HSSF.UserModel.HSSFCell)row.CreateCell(colPos);
            cell.SetCellValue("Net Pay");
            cell.CellStyle = ColumnHeaderStyle;
            colPos++;
            //workSheet.Cells.Add(RowPos, colPos, "Employer Contribution", xf);
            cell = (NPOI.HSSF.UserModel.HSSFCell)row.CreateCell(colPos);
            cell.SetCellValue("Employer Contribution");
            cell.CellStyle = ColumnHeaderStyle;

            //workSheet.Cells.Merge((int)RowPos - 2, (int)RowPos - 2, 2, colPos);
            workSheet.AddMergedRegion(new NPOI.SS.Util.CellRangeAddress((int)RowPos - 2, (int)RowPos - 2, 1, colPos));

            return(RowPos);
        }
Ejemplo n.º 36
0
        void cargar()
        {
            Int32     id = Convert.ToInt32(Request.QueryString["IDVP"]);
            PedidoDAO db = new PedidoDAO();

            System.Data.DataSet ds         = db.BuscarPedido(id);
            DataTable           dtcabecera = ds.Tables[0];
            AsignaZonaDAO       db1        = new AsignaZonaDAO();
            string idusu = Session["IDUsuario"].ToString();

            txtnumeropuesto.Text      = Convert.ToString(dtcabecera.Rows[0]["NumeroPuesto"]);
            txtfecha.Text             = Convert.ToDateTime(dtcabecera.Rows[0]["fechaCheque"]).ToString("yyyy-MM-dd");
            ddlmercados.SelectedValue = Convert.ToString(dtcabecera.Rows[0]["IdMercado"]);
            lbligv.Text                = Convert.ToString(dtcabecera.Rows[0]["IGV"]);
            lbltotal.Text              = Convert.ToString(dtcabecera.Rows[0]["Total_Venta"]);
            lblnombre.Text             = Convert.ToString(dtcabecera.Rows[0]["NombrePropietario"]);
            ddlmoneda.SelectedValue    = Convert.ToString(dtcabecera.Rows[0]["Id_Moneda"]);
            ddlformapago.SelectedValue = Convert.ToString(dtcabecera.Rows[0]["Id_FormaPago"]);
            string idzona = Convert.ToString(dtcabecera.Rows[0]["IdZona"]);

            lblzona.Text = Convert.ToString(dtcabecera.Rows[0]["DescripLarga"]);
            cargarmercado(idzona);
            DataTable detalles = (DataTable)Session["detalles"];

            if (detalles.Rows.Count > 0)
            {
                detalles.Rows.Clear();
            }
            DataTable dtdetalles = ds.Tables[1];

            foreach (DataRow Rg in dtdetalles.Rows)
            {
                string  idpro         = Convert.ToString(Rg["Id_prod"]);
                string  Descripcion   = Convert.ToString(Rg["descripcion"]);
                decimal precio        = Convert.ToDecimal(Rg["PrecioUnit"]);
                int     dcantidad     = Convert.ToInt32(Rg["Paquetes"]);
                decimal peso          = Convert.ToDecimal(Rg["CantidadKilos"]);
                decimal igv           = Convert.ToDecimal(Rg["IGV"]);
                int     unidad        = Convert.ToInt32(Rg["Unidad"]);
                int     idmedida      = Convert.ToInt32(Rg["Id_UMedida"]);
                decimal cantidadkilos = Math.Round(dcantidad * peso, 2);
                if (idpro == "486" || idpro == "488" || idpro == "487")
                {
                    decimal total = dcantidad * precio * peso;
                    Util.Helper.Agregar_Detalles(detalles, idpro, Descripcion, precio, dcantidad, peso, igv, total, cantidadkilos, unidad, idmedida);
                    Session["detalles"] = detalles;
                }
                else
                {
                    if (precio <= 14.00m)
                    {
                        decimal total = dcantidad * precio * peso;
                        Util.Helper.Agregar_Detalles(detalles, idpro, Descripcion, precio, dcantidad, peso, igv, total, cantidadkilos, unidad, idmedida);
                        Session["detalles"] = detalles;
                    }
                    else
                    {
                        decimal total = dcantidad * precio;
                        Util.Helper.Agregar_Detalles(detalles, idpro, Descripcion, precio, dcantidad, peso, igv, total, cantidadkilos, unidad, idmedida);
                        Session["detalles"] = detalles;
                    }
                }
            }
            cargarDetalles();
            //lbltotal.Text = Util.Helper.TotalizarGrilla(grvDetalles,5).ToString();
        }
Ejemplo n.º 37
0
 public string GenerarPlanoXML(int idDocumento, string strNombreDocumento, int idCompania, string strCompania, string strUsuario, string strClave, System.Data.DataSet dsFuenteDatos, ref string Path, ref string strResultado)
 {
     object[] results = this.Invoke("GenerarPlanoXML", new object[] {
         idDocumento,
         strNombreDocumento,
         idCompania,
         strCompania,
         strUsuario,
         strClave,
         dsFuenteDatos,
         Path,
         strResultado
     });
     Path         = ((string)(results[1]));
     strResultado = ((string)(results[2]));
     return((string)(results[0]));
 }
Ejemplo n.º 38
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.gridControl1      = new DefaultEditor.UserGridControl();
     this.DataTable1        = new System.Data.DataTable();
     this.DataColumn1       = new System.Data.DataColumn();
     this.DataColumn2       = new System.Data.DataColumn();
     this.gridView1         = new DevExpress.XtraGrid.Views.Grid.GridView();
     this.colLastAccessTime = new DevExpress.XtraGrid.Columns.GridColumn();
     this.colEncrypted      = new DevExpress.XtraGrid.Columns.GridColumn();
     this.DataSet1          = new System.Data.DataSet();
     ((System.ComponentModel.ISupportInitialize)(this.gridControl1)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.DataTable1)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.gridView1)).BeginInit();
     ((System.ComponentModel.ISupportInitialize)(this.DataSet1)).BeginInit();
     this.SuspendLayout();
     //
     // gridControl1
     //
     this.gridControl1.DataSource = this.DataTable1;
     this.gridControl1.Dock       = System.Windows.Forms.DockStyle.Fill;
     //
     // gridControl1.EmbeddedNavigator
     //
     this.gridControl1.EmbeddedNavigator.Name = "";
     this.gridControl1.Location = new System.Drawing.Point(0, 0);
     this.gridControl1.MainView = this.gridView1;
     this.gridControl1.Name     = "gridControl1";
     this.gridControl1.Size     = new System.Drawing.Size(416, 270);
     this.gridControl1.TabIndex = 0;
     this.gridControl1.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
         this.gridView1
     });
     //
     // DataTable1
     //
     this.DataTable1.Columns.AddRange(new System.Data.DataColumn[] {
         this.DataColumn1,
         this.DataColumn2
     });
     this.DataTable1.TableName = "Table1";
     //
     // DataColumn1
     //
     this.DataColumn1.ColumnName = "LastAccessTime";
     this.DataColumn1.DataType   = typeof(System.DateTime);
     //
     // DataColumn2
     //
     this.DataColumn2.ColumnName = "Encrypted";
     this.DataColumn2.DataType   = typeof(bool);
     //
     // gridView1
     //
     this.gridView1.Columns.AddRange(new DevExpress.XtraGrid.Columns.GridColumn[] {
         this.colLastAccessTime,
         this.colEncrypted
     });
     this.gridView1.GridControl = this.gridControl1;
     this.gridView1.Name        = "gridView1";
     //
     // colLastAccessTime
     //
     this.colLastAccessTime.Caption      = "LastAccessTime";
     this.colLastAccessTime.FieldName    = "LastAccessTime";
     this.colLastAccessTime.Name         = "colLastAccessTime";
     this.colLastAccessTime.Visible      = true;
     this.colLastAccessTime.VisibleIndex = 0;
     //
     // colEncrypted
     //
     this.colEncrypted.Caption      = "Encrypted";
     this.colEncrypted.FieldName    = "Encrypted";
     this.colEncrypted.Name         = "colEncrypted";
     this.colEncrypted.Visible      = true;
     this.colEncrypted.VisibleIndex = 1;
     //
     // DataSet1
     //
     this.DataSet1.DataSetName = "NewDataSet";
     this.DataSet1.Locale      = new System.Globalization.CultureInfo("en-US");
     this.DataSet1.Tables.AddRange(new System.Data.DataTable[] {
         this.DataTable1
     });
     //
     // Form1
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.ClientSize        = new System.Drawing.Size(416, 270);
     this.Controls.Add(this.gridControl1);
     this.Name  = "Form1";
     this.Text  = "Form1";
     this.Load += new System.EventHandler(this.Form1_Load);
     ((System.ComponentModel.ISupportInitialize)(this.gridControl1)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.DataTable1)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.gridView1)).EndInit();
     ((System.ComponentModel.ISupportInitialize)(this.DataSet1)).EndInit();
     this.ResumeLayout(false);
 }
Ejemplo n.º 39
0
        private void LoadReport()
        {
            rptVwrTodaysSales.Visible = true;
            rptVwrTodaysSales.LocalReport.ReportPath = string.Format(Server.MapPath(@"rdl\TodaysSalesReport.rdl"));

            SqlCommand cmd = new SqlCommand();

            DateTime dtFromDate = Convert.ToDateTime(txtFromDate.Text.ToString());
            DateTime dtToDate   = Convert.ToDateTime(txtToDate.Text.ToString());

            cmd.Parameters.Add(new SqlParameter("@FromDay", dtFromDate.Day));
            cmd.Parameters.Add(new SqlParameter("@FromMonth", dtFromDate.Month));
            cmd.Parameters.Add(new SqlParameter("@FromYear", dtFromDate.Year));

            cmd.Parameters.Add(new SqlParameter("@ToDay", dtToDate.Day));
            cmd.Parameters.Add(new SqlParameter("@ToMonth", dtToDate.Month));
            cmd.Parameters.Add(new SqlParameter("@ToYear", dtToDate.Year));

            string thisConnectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;

            SqlConnection thisConnection = new SqlConnection(thisConnectionString);

            cmd.Connection = thisConnection;

            cmd.CommandText = "usp_getTodaysSales";
            cmd.CommandType = CommandType.StoredProcedure;
            SqlDataAdapter da = new SqlDataAdapter(cmd);

            System.Data.DataSet thisDataSet = new System.Data.DataSet();

            /* Put the stored procedure result into a dataset */
            da.Fill(thisDataSet);

            /* Associate thisDataSet  (now loaded with the stored
             * procedure result) with the  ReportViewer datasource */

            ReportDataSource datasource = new ReportDataSource("dtsetTodaysSales", thisDataSet.Tables[0]);

            rptVwrTodaysSales.LocalReport.DataSources.Clear();
            rptVwrTodaysSales.LocalReport.DataSources.Add(datasource);



            //if (thisDataSet.Tables[0].Rows.Count == 0)
            //{

            //}



            using (StreamReader rdlcSR = new StreamReader(Server.MapPath(@"rdl\TodaysSalesReport.rdl")))
            {
                rptVwrTodaysSales.LocalReport.LoadReportDefinition(rdlcSR);

                List <ReportParameter> lst = new List <ReportParameter>();

                ReportParameter rptParam1 = new ReportParameter("FromDay", dtFromDate.Day.ToString());
                ReportParameter rptParam2 = new ReportParameter("FromMonth", dtFromDate.Month.ToString());
                ReportParameter rptParam3 = new ReportParameter("FromYear", dtFromDate.Year.ToString());

                ReportParameter rptParam4 = new ReportParameter("ToDay", dtToDate.Day.ToString());
                ReportParameter rptParam5 = new ReportParameter("ToMonth", dtToDate.Month.ToString());
                ReportParameter rptParam6 = new ReportParameter("ToYear", dtToDate.Year.ToString());


                lst.Add(rptParam1);
                lst.Add(rptParam2);
                lst.Add(rptParam3);
                lst.Add(rptParam4);
                lst.Add(rptParam5);
                lst.Add(rptParam6);

                rptVwrTodaysSales.LocalReport.SetParameters(lst);
                rptVwrTodaysSales.LocalReport.Refresh();
            }
        }
Ejemplo n.º 40
0
        private void btnExcel_Click(object sender, EventArgs e)
        {
            clsConnection clscon = new clsConnection();

            dsList = new System.Data.DataSet();



            if (gridCriteria.ActiveRow.Cells[0].Value.ToString().ToUpper() == "General".ToUpper())
            {
                string sqlquary = "Exec rptLeave " + Common.Classes.clsMain.intComId + ", '" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', '" + clsProc.GTRDate(dtDateTo.Value.ToString()) + "', '" + (gridSec.ActiveRow.Cells["sectid"].Value.ToString()) + "',  '" + (gridEmp.ActiveRow.Cells["empid"].Value.ToString()) + "','" + (gridActive.ActiveRow.Cells["SL"].Value.ToString()) + "','" + (gridEmpType.ActiveRow.Cells["varName"].Value.ToString()) + "','General'";
                clscon.GTRFillDatasetWithSQLCommand(ref dsList, sqlquary);

                dsList.Tables[0].TableName = "tblLeaveDetails";

                gridExcel.DataSource = null;
                gridExcel.DataSource = dsList.Tables["tblLeaveDetails"];
            }

            else if (gridCriteria.ActiveRow.Cells[0].Value.ToString().ToUpper() == "ML".ToUpper())
            {
                string sqlquary = "Exec rptLeave " + Common.Classes.clsMain.intComId + ", '" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', '" + clsProc.GTRDate(dtDateTo.Value.ToString()) + "', '" + (gridSec.ActiveRow.Cells["sectid"].Value.ToString()) + "',  '" + (gridEmp.ActiveRow.Cells["empid"].Value.ToString()) + "','" + (gridActive.ActiveRow.Cells["SL"].Value.ToString()) + "','" + (gridEmpType.ActiveRow.Cells["varName"].Value.ToString()) + "', 'ML'";
                clscon.GTRFillDatasetWithSQLCommand(ref dsList, sqlquary);

                dsList.Tables[0].TableName = "tblLeaveDetails";

                gridExcel.DataSource = null;
                gridExcel.DataSource = dsList.Tables["tblLeaveDetails"];
            }
            else if (gridCriteria.ActiveRow.Cells[0].Value.ToString().ToUpper() == "FirstML".ToUpper())
            {
                string sqlquary = "Exec rptLeave " + Common.Classes.clsMain.intComId + ", '" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', '" + clsProc.GTRDate(dtDateTo.Value.ToString()) + "', '" + (gridSec.ActiveRow.Cells["sectid"].Value.ToString()) + "',  '" + (gridEmp.ActiveRow.Cells["empid"].Value.ToString()) + "','" + (gridActive.ActiveRow.Cells["SL"].Value.ToString()) + "','" + (gridEmpType.ActiveRow.Cells["varName"].Value.ToString()) + "', 'FirstML'";
                clscon.GTRFillDatasetWithSQLCommand(ref dsList, sqlquary);

                dsList.Tables[0].TableName = "tblLeaveDetails";

                gridExcel.DataSource = null;
                gridExcel.DataSource = dsList.Tables["tblLeaveDetails"];
            }

            else if (gridCriteria.ActiveRow.Cells[0].Value.ToString().ToUpper() == "LastML".ToUpper())
            {
                string sqlquary = "Exec rptLeave " + Common.Classes.clsMain.intComId + ", '" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', '" + clsProc.GTRDate(dtDateTo.Value.ToString()) + "', '" + (gridSec.ActiveRow.Cells["sectid"].Value.ToString()) + "',  '" + (gridEmp.ActiveRow.Cells["empid"].Value.ToString()) + "','" + (gridActive.ActiveRow.Cells["SL"].Value.ToString()) + "','" + (gridEmpType.ActiveRow.Cells["varName"].Value.ToString()) + "', 'LastML'";
                clscon.GTRFillDatasetWithSQLCommand(ref dsList, sqlquary);

                dsList.Tables[0].TableName = "tblLeaveDetails";

                gridExcel.DataSource = null;
                gridExcel.DataSource = dsList.Tables["tblLeaveDetails"];
            }

            else if (gridCriteria.ActiveRow.Cells[0].Value.ToString().ToUpper() == "Details".ToUpper())
            {
                string sqlquary = "Exec rptLeaveBalance " + Common.Classes.clsMain.intComId + ", '" + cboFinyear.Value.ToString() + "', '" + (gridSec.ActiveRow.Cells["sectid"].Value.ToString()) + "',  '" + (gridEmp.ActiveRow.Cells["empid"].Value.ToString()) + "','" + (gridActive.ActiveRow.Cells["SL"].Value.ToString()) + "','" + (gridEmpType.ActiveRow.Cells["varName"].Value.ToString()) + "', 'Details'";
                clscon.GTRFillDatasetWithSQLCommand(ref dsList, sqlquary);

                dsList.Tables[0].TableName = "tblLeaveDetails";

                gridExcel.DataSource = null;
                gridExcel.DataSource = dsList.Tables["tblLeaveDetails"];
            }

            else if (gridCriteria.ActiveRow.Cells[0].Value.ToString().ToUpper() == "Summary".ToUpper())
            {
                string sqlquary = "Exec rptLeaveBalance " + Common.Classes.clsMain.intComId + ", " + cboFinyear.Value.ToString() + ",'" + (gridSec.ActiveRow.Cells["sectid"].Value.ToString()) + "',  '" + (gridEmp.ActiveRow.Cells["empid"].Value.ToString()) + "','" + (gridActive.ActiveRow.Cells["SL"].Value.ToString()) + "','" + (gridEmpType.ActiveRow.Cells["varName"].Value.ToString()) + "','Summary'";
                clscon.GTRFillDatasetWithSQLCommand(ref dsList, sqlquary);

                dsList.Tables[0].TableName = "tblLeaveDetails";

                gridExcel.DataSource = null;
                gridExcel.DataSource = dsList.Tables["tblLeaveDetails"];
            }

            else if (gridCriteria.ActiveRow.Cells[0].Value.ToString().ToUpper() == "MonthDetails".ToUpper())
            {
                string sqlquary = "Exec rptLeaveBalanceDetails " + Common.Classes.clsMain.intComId + ", " + cboFinyear.Value.ToString() + ",'" + (gridSec.ActiveRow.Cells["sectid"].Value.ToString()) + "',  '" + (gridEmp.ActiveRow.Cells["empid"].Value.ToString()) + "','" + (gridActive.ActiveRow.Cells["SL"].Value.ToString()) + "','" + (gridEmpType.ActiveRow.Cells["varName"].Value.ToString()) + "', 'MonthDetails'";
                clscon.GTRFillDatasetWithSQLCommand(ref dsList, sqlquary);

                dsList.Tables[0].TableName = "tblLeaveDetails";

                gridExcel.DataSource = null;
                gridExcel.DataSource = dsList.Tables["tblLeaveDetails"];
            }


            DialogResult dlgRes =
                MessageBox.Show("Do You Want to Save the Data Sheet");

            if (dlgRes != DialogResult.OK)
            {
                return;
            }

            SaveFileDialog dlgSurveyExcel = new SaveFileDialog();

            dlgSurveyExcel.Filter   = "Excel WorkBook (*.xls)|.xls";
            dlgSurveyExcel.FileName = gridCriteria.ActiveRow.Cells["Criteria"].Text.ToString() + "_" + DateTime.Now.ToShortDateString().Replace(@"/", "_");

            dlgSurveyExcel.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            DialogResult dlgResSaveFile = dlgSurveyExcel.ShowDialog();

            if (dlgResSaveFile == DialogResult.Cancel)
            {
                return;
            }

            Cursor.Current = Cursors.WaitCursor;

            Application.DoEvents();
            UltraGridExcelExporter GridToToExcel = new UltraGridExcelExporter();

            GridToToExcel.FileLimitBehaviour = FileLimitBehaviour.TruncateData;
            GridToToExcel.InitializeColumn  += new InitializeColumnEventHandler(GridToToExcel_InitializeColumn);
            GridToToExcel.Export(gridExcel, dlgSurveyExcel.FileName);

            MessageBox.Show("Download complete.");
        }
Ejemplo n.º 41
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            dsDetails = new DataSet();

            ArrayList arQuery = new ArrayList();

            GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection();

            try
            {
                string ReportPath = "", SQLQuery = "", DataSourceName = "DataSet1", FormCaption = "";

                DataSourceName = "DataSet1";
                FormCaption    = "Report :: Leave Information...";

                if (gridCriteria.ActiveRow.Cells[0].Value.ToString().ToUpper() == "General".ToUpper())
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Attendence\Reports\rptLeaveList.rdlc";
                    SQLQuery   = "Exec rptLeave " + Common.Classes.clsMain.intComId + ", '" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', '" + clsProc.GTRDate(dtDateTo.Value.ToString()) + "', '" + (gridSec.ActiveRow.Cells["sectid"].Value.ToString()) + "',  '" + (gridEmp.ActiveRow.Cells["empid"].Value.ToString()) + "','" + (gridActive.ActiveRow.Cells["SL"].Value.ToString()) + "','=ALL=','General'";
                }

                else if (gridCriteria.ActiveRow.Cells[0].Value.ToString().ToUpper() == "ML".ToUpper())
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Attendence\Reports\rptLeaveList.rdlc";
                    SQLQuery   = "Exec rptLeave " + Common.Classes.clsMain.intComId + ", '" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', '" + clsProc.GTRDate(dtDateTo.Value.ToString()) + "', '" + (gridSec.ActiveRow.Cells["sectid"].Value.ToString()) + "',  '" + (gridEmp.ActiveRow.Cells["empid"].Value.ToString()) + "','" + (gridActive.ActiveRow.Cells["SL"].Value.ToString()) + "','" + (gridEmpType.ActiveRow.Cells["varName"].Value.ToString()) + "', 'ML'";
                }
                else if (gridCriteria.ActiveRow.Cells[0].Value.ToString().ToUpper() == "FirstML".ToUpper())
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Attendence\Reports\rptLeaveList.rdlc";
                    SQLQuery   = "Exec rptLeave " + Common.Classes.clsMain.intComId + ", '" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', '" + clsProc.GTRDate(dtDateTo.Value.ToString()) + "', '" + (gridSec.ActiveRow.Cells["sectid"].Value.ToString()) + "',  '" + (gridEmp.ActiveRow.Cells["empid"].Value.ToString()) + "','" + (gridActive.ActiveRow.Cells["SL"].Value.ToString()) + "','" + (gridEmpType.ActiveRow.Cells["varName"].Value.ToString()) + "', 'FirstML'";
                }
                else if (gridCriteria.ActiveRow.Cells[0].Value.ToString().ToUpper() == "LastML".ToUpper())
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Attendence\Reports\rptLeaveList.rdlc";
                    SQLQuery   = "Exec rptLeave " + Common.Classes.clsMain.intComId + ", '" + clsProc.GTRDate(dtDateFrom.Value.ToString()) + "', '" + clsProc.GTRDate(dtDateTo.Value.ToString()) + "', '" + (gridSec.ActiveRow.Cells["sectid"].Value.ToString()) + "',  '" + (gridEmp.ActiveRow.Cells["empid"].Value.ToString()) + "','" + (gridActive.ActiveRow.Cells["SL"].Value.ToString()) + "','" + (gridEmpType.ActiveRow.Cells["varName"].Value.ToString()) + "', 'LastML'";
                }
                else if (gridCriteria.ActiveRow.Cells[0].Value.ToString().ToUpper() == "Details".ToUpper())
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Attendence\Reports\rptLeaveDetails.rdlc";
                    SQLQuery   = "Exec rptLeaveBalance " + Common.Classes.clsMain.intComId + ", '" + cboFinyear.Value.ToString() + "', '" + (gridSec.ActiveRow.Cells["sectid"].Value.ToString()) + "',  '" + (gridEmp.ActiveRow.Cells["empid"].Value.ToString()) + "','" + (gridActive.ActiveRow.Cells["SL"].Value.ToString()) + "','" + (gridEmpType.ActiveRow.Cells["varName"].Value.ToString()) + "', 'Details'";
                }
                else if (gridCriteria.ActiveRow.Cells[0].Value.ToString().ToUpper() == "Summary".ToUpper())
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Attendence\Reports\rptLeaveSum.rdlc";
                    SQLQuery   = "Exec rptLeaveBalance " + Common.Classes.clsMain.intComId + ", " + cboFinyear.Value.ToString() + ",'" + (gridSec.ActiveRow.Cells["sectid"].Value.ToString()) + "',  '" + (gridEmp.ActiveRow.Cells["empid"].Value.ToString()) + "','" + (gridActive.ActiveRow.Cells["SL"].Value.ToString()) + "','" + (gridEmpType.ActiveRow.Cells["varName"].Value.ToString()) + "','Summary'";
                }

                else if (gridCriteria.ActiveRow.Cells[0].Value.ToString().ToUpper() == "MonthDetails".ToUpper())
                {
                    ReportPath = Common.Classes.clsMain.AppPath + @"\Attendence\Reports\rptLeaveMonthDetails.rdlc";
                    SQLQuery   = "Exec rptLeaveBalanceDetails " + Common.Classes.clsMain.intComId + ", " + cboFinyear.Value.ToString() + ",'" + (gridSec.ActiveRow.Cells["sectid"].Value.ToString()) + "',  '" + (gridEmp.ActiveRow.Cells["empid"].Value.ToString()) + "','" + (gridActive.ActiveRow.Cells["SL"].Value.ToString()) + "','" + (gridEmpType.ActiveRow.Cells["varName"].Value.ToString()) + "', 'MonthDetails'";
                }

                clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, SQLQuery);

                if (dsDetails.Tables[0].Rows.Count == 0)
                {
                    MessageBox.Show("Data Not Found");
                    return;
                }

                clsReport.strReportPathMain         = ReportPath;
                clsReport.dsReport                  = dsDetails;
                clsReport.strDSNMain                = DataSourceName;
                Common.Classes.clsMain.strExtension = optFormat.Value.ToString();
                Common.Classes.clsMain.strFormat    = optFormat.Text.ToString();
                FM.prcShowReport(FormCaption);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 42
0
 public void GetBy(HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_TKeys keys, ref System.Data.DataSet dataSet)
 {
     try
     {
         _dataObject.SelectByPrimaryKey(keys, ref dataSet);
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Ejemplo n.º 43
0
        /// <summary>
        /// Executes the query.
        /// </summary>
        /// <param name="dataTable">The data table to return containing the data.</param>
        /// <param name="queryText">The query text to execute.</param>
        /// <param name="commandType">The command type.</param>
        /// <param name="connectionString">The connection string to use.</param>
        /// <param name="getSchemaTable">Get the table schema from the database and then load the data. Used when
        /// returning data from the database for a particilar table.</param>
        /// <param name="values">The collection of sql parameters to include.</param>
        /// <returns>The sql command containing any return values.</returns>
        public DbCommand ExecuteQuery(ref DataTable dataTable, string queryText, CommandType commandType,
                                      string connectionString, bool getSchemaTable, params DbParameter[] values)
        {
            // Initial connection objects.
            DbCommand dbCommand = null;

            OracleClient.OracleConnection orlConnection = null;
            IDataReader dataReader = null;


            try
            {
                // Create a new connection.
                using (orlConnection = new OracleClient.OracleConnection(connectionString))
                {
                    // Open the connection.
                    orlConnection.Open();

                    // Create the command and assign any parameters.
                    dbCommand = new OracleClient.OracleCommand(DataTypeConversion.GetSqlConversionDataTypeNoContainer(
                                                                   ConnectionContext.ConnectionDataType.OracleDataType, queryText), orlConnection);
                    dbCommand.CommandType = commandType;

                    if (values != null)
                    {
                        foreach (OracleClient.OracleParameter sqlParameter in values)
                        {
                            dbCommand.Parameters.Add(sqlParameter);
                        }
                    }

                    // Load the data into the table.
                    using (dataReader = dbCommand.ExecuteReader())
                    {
                        // Get the schema from the data because the
                        // table has not predefined schema
                        if (getSchemaTable)
                        {
                            // Load the table after the schema is
                            // returned.
                            dataTable = dataReader.GetSchemaTable();
                            dataTable = new DataTable();
                            System.Data.DataSet localDataSet = new System.Data.DataSet();
                            localDataSet.EnforceConstraints = false;
                            localDataSet.Tables.Add(dataTable);
                            dataTable.Load(dataReader);
                        }
                        else
                        {
                            // Load the data into a table schema.
                            // Load the data into a table schema.
                            System.Data.DataSet localDataSet = new System.Data.DataSet();
                            localDataSet.EnforceConstraints = false;
                            localDataSet.Tables.Add(dataTable);
                            dataTable.Load(dataReader);
                        }

                        dataReader.Close();
                    }

                    // Close the database connection.
                    orlConnection.Close();
                }

                // Return the sql command, including
                // any parameters that have been
                // marked as output direction.
                return(dbCommand);
            }
            catch (Exception ex)
            {
                // Throw a general exception.
                throw new Exception(ex.Message, ex.InnerException);
            }
            finally
            {
                if (dataReader != null)
                {
                    dataReader.Close();
                }

                if (orlConnection != null)
                {
                    orlConnection.Close();
                }
            }
        }
Ejemplo n.º 44
0
        /// <summary>
        /// Executes the query.
        /// </summary>
        /// <typeparam name="TypeDataTable">The data type to examine.</typeparam>
        /// <param name="dataTable">The data table to return containing the data.</param>
        /// <param name="queryText">The query text to execute.</param>
        /// <param name="commandType">The command type.</param>
        /// <param name="connectionString">The connection string to use.</param>
        /// <param name="values">The collection of sql parameters to include.</param>
        /// <returns>The sql command containing any return values.</returns>
        public DbCommand ExecuteClientQuery <TypeDataTable>(ref TypeDataTable dataTable,
                                                            string queryText, CommandType commandType, string connectionString, params DbParameter[] values)
            where TypeDataTable : DataTable, new()
        {
            // Initial connection objects.
            OracleClient.OracleCommand    sqlCommand = null;
            OracleClient.OracleConnection connection = null;
            IDataReader dataReader = null;

            dataTable = new TypeDataTable();

            try
            {
                // Create a new connection.
                using (connection = new OracleClient.OracleConnection(connectionString))
                {
                    // Open the connection.
                    connection.Open();

                    // Create the command and assign any parameters.
                    sqlCommand             = new OracleClient.OracleCommand(queryText, connection);
                    sqlCommand.CommandType = commandType;

                    if (values != null)
                    {
                        foreach (OracleClient.OracleParameter sqlParameter in values)
                        {
                            sqlCommand.Parameters.Add(sqlParameter);
                        }
                    }

                    // Load the data into the table.
                    using (dataReader = sqlCommand.ExecuteReader())
                    {
                        System.Data.DataSet localDataSet = new System.Data.DataSet();
                        localDataSet.EnforceConstraints = false;
                        localDataSet.Tables.Add(dataTable);
                        dataTable.Load(dataReader);
                        dataReader.Close();
                    }

                    // Close the database connection.
                    connection.Close();
                }

                // Return the sql command, including
                // any parameters that have been
                // marked as output direction.
                return(sqlCommand);
            }
            catch (Exception ex)
            {
                // Throw a general exception.
                throw new Exception(ex.Message, ex.InnerException);
            }
            finally
            {
                if (dataReader != null)
                {
                    dataReader.Close();
                }

                if (connection != null)
                {
                    connection.Close();
                }
            }
        }
Ejemplo n.º 45
0
        void btnPreview_Click(object sender, EventArgs e)
        {
            string criteria = string.Empty;

            if (string.IsNullOrEmpty(radioGroup1.EditValue.ToString()))
            {
                Common.setMessageBox("Search Criteria Option not Selected....!", Program.ApplicationName, 2);
                return;
            }
            else
            {
                try
                {
                    SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);


                    if (boolIsUpdate)
                    {
                        //exception report
                        if ((Int32)this.radioGroup1.EditValue == 0)
                        {
                            criteria = string.Format("SELECT Collection.tblCollectionReport.PaymentRefNumber , DepositSlipNumber ,  PaymentDate , [PayerID] , UPPER(PayerName) AS PayerName ,AgencyName ,  Description ,  Amount ,BankName + ',' + BranchName AS Bank , Collection.tblCollectionReport.EReceipts ,Collection.tblCollectionReport.StationCode ,( SELECT TOP 1 StationName FROM Receipt.tblStation WHERE tblStation.StationCode = Collection.tblCollectionReport.[StationCode]) AS StationName FROM Collection.tblCollectionReport WHERE  Collection.tblCollectionReport.EReceiptsDate >='{0}' And Collection.tblCollectionReport.EReceiptsDate  <= '{1}'  AND RevenueCode IN ( SELECT RevenueCode  FROM   Receipt.tblRevenueReceiptException ) ORDER BY Collection.tblCollectionReport.AgencyName ,        Collection.tblCollectionReport.Description , Collection.tblCollectionReport.EReceipts", string.Format("{0:MM/dd/yyyy 00:00:00}", dtpDate.Value), string.Format("{0:MM/dd/yyyy 23:59:59}", dtpenddate.Value));
                        }
                        else if ((Int32)this.radioGroup1.EditValue == 1)
                        {
                            criteria = string.Format("SELECT Collection.tblCollectionReport.PaymentRefNumber , DepositSlipNumber ,  PaymentDate , [PayerID] , UPPER(PayerName) AS PayerName ,AgencyName ,  Description ,  Amount ,BankName + ',' + BranchName AS Bank , Collection.tblCollectionReport.EReceipts ,Collection.tblCollectionReport.StationCode ,( SELECT TOP 1 StationName FROM Receipt.tblStation WHERE tblStation.StationCode = Collection.tblCollectionReport.[StationCode]) AS StationName FROM Collection.tblCollectionReport WHERE  Collection.tblCollectionReport.PaymentRefNumber Like '%{0}%'  AND RevenueCode IN ( SELECT RevenueCode  FROM   Receipt.tblRevenueReceiptException ) ORDER BY Collection.tblCollectionReport.AgencyName ,        Collection.tblCollectionReport.Description , Collection.tblCollectionReport.EReceipts", txtpayRef.Text.Trim());
                        }
                    }
                    else
                    {
                        //pyment report

                        //groupBox1.Text = "Payment Report";
                        if ((Int32)this.radioGroup1.EditValue == 0)
                        {
                            criteria = string.Format("SELECT  Collection.tblCollectionReport.PaymentRefNumber , DepositSlipNumber , PaymentDate , [PayerID] ,UPPER(PayerName) AS PayerName , AgencyName , Description ,  Amount , BankName + ',' + BranchName AS Bank , Collection.tblCollectionReport.EReceipts , ControlNumber , ControlNumberBy , ControlNumberDate , PrintedBY , Collection.tblCollectionReport.StationCode , ( SELECT TOP 1     StationName FROM  Receipt.tblStation  WHERE  tblStation.StationCode = Collection.tblCollectionReport.[StationCode]) AS StationName FROM Collection.tblCollectionReport LEFT JOIN Receipt.tblCollectionReceipt ON Receipt.tblCollectionReceipt.PaymentRefNumber = Collection.tblCollectionReport.PaymentRefNumber WHERE Collection.tblCollectionReport.EReceiptsDate >='{0}' And Collection.tblCollectionReport.EReceiptsDate  <= '{1}'  ORDER BY Collection.tblCollectionReport.AgencyName ,        Collection.tblCollectionReport.Description , Collection.tblCollectionReport.EReceipts", string.Format("{0:MM/dd/yyyy 00:00:00}", dtpDate.Value), string.Format("{0:MM/dd/yyyy 23:59:59}", dtpenddate.Value));
                        }
                        else if ((Int32)this.radioGroup1.EditValue == 1)
                        {
                            criteria = string.Format("SELECT  Collection.tblCollectionReport.PaymentRefNumber , DepositSlipNumber , PaymentDate , [PayerID] ,UPPER(PayerName) AS PayerName , AgencyName , Description ,  Amount , BankName + ',' + BranchName AS Bank , Collection.tblCollectionReport.EReceipts , ControlNumber , ControlNumberBy , ControlNumberDate , PrintedBY , Collection.tblCollectionReport.StationCode , ( SELECT TOP 1     StationName FROM  Receipt.tblStation  WHERE  tblStation.StationCode = Collection.tblCollectionReport.[StationCode]) AS StationName FROM Collection.tblCollectionReport LEFT JOIN Receipt.tblCollectionReceipt ON Receipt.tblCollectionReceipt.PaymentRefNumber = Collection.tblCollectionReport.PaymentRefNumber WHERE  Collection.tblCollectionReport.PaymentRefNumber Like '%{0}%'  ORDER BY Collection.tblCollectionReport.AgencyName ,        Collection.tblCollectionReport.Description , Collection.tblCollectionReport.EReceipts", txtpayRef.Text.Trim());
                        }
                    }

                    using (var ds = new System.Data.DataSet())
                    {
                        ds.Clear();

                        using (SqlDataAdapter ada = new SqlDataAdapter(criteria, Logic.ConnectionString))
                        {
                            ada.Fill(ds, "table");
                        }

                        if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                        {
                            if (boolIsUpdate)
                            {
                                if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                                {
                                    ////using object class
                                    var listexpection = (from DataRow row in ds.Tables[0].Rows
                                                         select new DataSet.Reports
                                    {
                                        PaymentRefNumber = row["PaymentRefNumber"] as string,
                                        DepositSlipNumber = row["DepositSlipNumber"] as string,
                                        PaymentDate = Convert.ToDateTime(row["PaymentDate"]),
                                        PayerID = row["PayerID"] as string,
                                        PayerName = row["PayerName"] as string,
                                        AgencyName = row["AgencyName"] as string,
                                        Description = row["Description"] as string,
                                        Amount = Convert.ToDecimal(row["Amount"]),
                                        Bank = row["Bank"] as string,
                                        EReceipts = row["EReceipts"] as string,
                                        StationCode = row["StationCode"] as string,
                                        StationName = row["StationName"] as string
                                    }
                                                         ).ToList();

                                    XtraRepExecptionReport report = new XtraRepExecptionReport();
                                    var bindsoucre = (BindingSource)report.DataSource;
                                    bindsoucre.Clear();
                                    bindsoucre.DataSource = listexpection;
                                    report.xrLabel12.Text = string.Format("{0} State Government", Program.StateName.ToUpper());
                                    report.xrLabel13.Text = string.Format("List of Revenue Receipts Exception between {0} and {1}", string.Format("{0:dd/MM/yyyy}", dtpDate.Value), string.Format("{0:dd/MM/yyyy}", dtpenddate.Value));
                                    report.ShowPreviewDialog();
                                }
                                else
                                {
                                    Common.setMessageBox("No Record Found", Program.ApplicationName, 1); return;
                                }
                            }
                            else
                            {
                                if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                                {
                                    var list = (from DataRow rows in ds.Tables[0].Rows
                                                select new DataSet.Reports2
                                    {
                                        PaymentRefNumber = rows["PaymentRefNumber"] as string
                                        ,
                                        DepositSlipNumber = rows["DepositSlipNumber"] as string,
                                        PaymentDate = Convert.ToDateTime(rows["PaymentDate"]),
                                        PayerID = rows["PayerID"] as string,
                                        PayerName = rows["PayerName"] as string,
                                        AgencyName = rows["AgencyName"] as string,
                                        Description = rows["Description"] as string
                                        ,
                                        Amount = Convert.ToDecimal(rows["Amount"]),
                                        Bank = rows["Bank"] as string,
                                        EReceipts = rows["EReceipts"] as string,
                                        StationCode = rows["StationCode"] as string,
                                        StationName = rows["StationName"] as string,
                                        ControlNumber = rows["ControlNumber"] as string,
                                        //ControlNumberDate = Convert.ToDateTime(rows["ControlNumberDate"]),
                                        PrintedBY = rows["PrintedBY"] as string
                                    }
                                                ).ToList();

                                    XtraRepPayments report = new XtraRepPayments();

                                    var bindsoucre = (BindingSource)report.DataSource;
                                    bindsoucre.Clear();
                                    bindsoucre.DataSource = list;
                                    report.xrLabel12.Text = string.Format("{0} State Government", Program.StateName.ToUpper());
                                    report.xrLabel13.Text = string.Format("List of Payment Collections Reports between {0} and {1}", string.Format("{0:dd/MM/yyyy}", dtpDate.Value), string.Format("{0:dd/MM/yyyy}", dtpenddate.Value));
                                    report.ShowPreviewDialog();
                                }
                                else
                                {
                                    Common.setMessageBox("No Record Found", Program.ApplicationName, 1); return;
                                }
                            }
                        }
                        else
                        {
                            Common.setMessageBox("No Record Found", Program.ApplicationName, 1);
                            return;
                        }
                    }
                }
                finally
                {
                    SplashScreenManager.CloseForm(false);
                }
            }
        }
Ejemplo n.º 46
0
        protected override void GenerateWorkbookDetail(NPOI.HSSF.UserModel.HSSFWorkbook workBook, System.Data.DataSet dataSet)
        {
            NPOI.HSSF.UserModel.HSSFSheet workSheet = (NPOI.HSSF.UserModel.HSSFSheet)workBook.CreateSheet("Payroll Detail");

            ushort rowPos = 0;

            DataTable empInfoTable          = dataSet.Tables["EmpInfo"];
            DataTable paymentTable          = dataSet.Tables["payment"];
            DataTable costCenterDetailTable = dataSet.Tables["CostCenterDetail"];

            NPOI.HSSF.UserModel.HSSFFont boldFont = (NPOI.HSSF.UserModel.HSSFFont)workBook.CreateFont();
            boldFont.Boldweight = 700;

            NPOI.HSSF.UserModel.HSSFCellStyle reportHeaderStyle = (NPOI.HSSF.UserModel.HSSFCellStyle)workBook.CreateCellStyle();
            reportHeaderStyle.SetFont(boldFont);
            reportHeaderStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.CENTER;

            NPOI.HSSF.UserModel.HSSFCellStyle groupHeaderStyle = (NPOI.HSSF.UserModel.HSSFCellStyle)workBook.CreateCellStyle();
            groupHeaderStyle.SetFont(boldFont);

            NPOI.HSSF.UserModel.HSSFCellStyle columnHeaderStyle = (NPOI.HSSF.UserModel.HSSFCellStyle)workBook.CreateCellStyle();
            columnHeaderStyle.SetFont(boldFont);
            columnHeaderStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.THIN;

            NPOI.HSSF.UserModel.HSSFCellStyle detailStyle = (NPOI.HSSF.UserModel.HSSFCellStyle)workBook.CreateCellStyle();
            detailStyle.DataFormat = workBook.CreateDataFormat().GetFormat("#,##0.00;(#,##0.00)");

            NPOI.HSSF.UserModel.HSSFCellStyle subTotalStyle = (NPOI.HSSF.UserModel.HSSFCellStyle)workBook.CreateCellStyle();
            subTotalStyle.DataFormat = workBook.CreateDataFormat().GetFormat("#,##0.00;(#,##0.00)");
            subTotalStyle.BorderTop  = NPOI.SS.UserModel.BorderStyle.THIN;

            //rowPos = GenerateHeader(xlsDoc, workSheet, PeriodFrom, PeriodTo, rowPos);
            rowPos = GenerateHeader(workSheet, PeriodFrom, PeriodTo, rowPos, reportHeaderStyle, groupHeaderStyle);

            DataRow[] rows = dataSet.Tables["EmpInfo"].Select("", "Company, " + empInfoTable.Columns[hierarchyLevelGroupingFieldName].ColumnName + ", Employee Name, Alias");

            string    currentCompany             = string.Empty;
            string    currentHierarchyGroup      = string.Empty;
            string    currentEmployeeNo          = string.Empty;
            ushort    groupRowCount              = 0;
            Hashtable groupedTotalCostCenterHash = new Hashtable();
            ArrayList subTotalRowList            = new ArrayList();
            Hashtable paymentHashTable           = new Hashtable();
            Hashtable companyTotalHashTable      = new Hashtable();
            double    netPayment        = 0;
            double    companyNetPayment = 0;

            double employerContribution        = 0;
            double companyEmployerContribution = 0;

            ArrayList companyTotalRowNumList = new ArrayList();

            foreach (DataRow row in rows)
            {
                string tmpCompany    = row["Company"].ToString();
                string tmpHierarchy  = row[hierarchyLevelGroupingFieldName].ToString();
                string tmpEmployeeNo = row["Employee No."].ToString();


                if (!currentCompany.Equals(tmpCompany, StringComparison.CurrentCultureIgnoreCase) || rows[0] == row)
                {
                    if (rows[0] != row)
                    {
                        groupRowCount++;

                        rowPos = GenerateHierarchyTotal(workSheet, paymentTable, currentHierarchyGroup, currentEmployeeNo, paymentHashTable, netPayment, employerContribution, rowPos, detailStyle);

                        paymentHashTable = new Hashtable();


                        rowPos = GenerateCompanyTotal(workSheet, paymentTable, groupRowCount, companyEmployerContribution, rowPos, subTotalStyle);

                        companyTotalRowNumList.Add(rowPos);

                        companyTotalHashTable = new Hashtable();
                    }
                    groupRowCount = 0;

                    netPayment            = 0;
                    employerContribution  = 0;
                    currentHierarchyGroup = tmpHierarchy;
                    currentEmployeeNo     = tmpEmployeeNo;

                    companyNetPayment           = 0;
                    companyEmployerContribution = 0;
                    currentCompany = tmpCompany;
                    rowPos         = GenerateColumnHeader(workSheet, dataSet, currentCompany, hierarchyLevelGroupingFieldName, rowPos, groupHeaderStyle, columnHeaderStyle);
                }
                else if (!currentHierarchyGroup.Equals(tmpHierarchy, StringComparison.CurrentCultureIgnoreCase))
                {
                    groupRowCount++;

                    rowPos = GenerateHierarchyTotal(workSheet, paymentTable, currentHierarchyGroup, currentEmployeeNo, paymentHashTable, netPayment, employerContribution, rowPos, detailStyle);

                    paymentHashTable      = new Hashtable();
                    netPayment            = 0;
                    employerContribution  = 0;
                    currentHierarchyGroup = tmpHierarchy;
                    currentEmployeeNo     = tmpEmployeeNo;
                }
                DataRow[] paymentRows = paymentTable.Select("[EmpPayrollID]='" + row["EmpPayrollID"].ToString() + "'");

                foreach (DataRow paymentRow in paymentRows)
                {
                    foreach (DataColumn column in paymentTable.Columns)
                    {
                        if (column.ColumnName.Equals("EmpPayrollID"))
                        {
                            continue;
                        }
                        double amount             = 0;
                        double companyTotalAmount = 0;
                        if (paymentHashTable.ContainsKey(column.ColumnName))
                        {
                            amount = (double)paymentHashTable[column.ColumnName];
                        }
                        else
                        {
                            paymentHashTable.Add(column.ColumnName, amount);
                        }

                        if (companyTotalHashTable.ContainsKey(column.ColumnName))
                        {
                            companyTotalAmount = (double)companyTotalHashTable[column.ColumnName];
                        }
                        else
                        {
                            companyTotalHashTable.Add(column.ColumnName, companyTotalAmount);
                        }

                        if (!string.IsNullOrEmpty(paymentRow[column.ColumnName].ToString()))
                        {
                            amount             += (double)paymentRow[column.ColumnName];
                            companyTotalAmount += (double)paymentRow[column.ColumnName];
                            netPayment         += (double)paymentRow[column.ColumnName];
                            companyNetPayment  += (double)paymentRow[column.ColumnName];
                            paymentHashTable[column.ColumnName]      = amount;
                            companyTotalHashTable[column.ColumnName] = companyTotalAmount;
                        }
                    }
                }
                if (!row.IsNull("MCER"))
                {
                    double contribution = (double)row["MCER"];
                    employerContribution        += contribution;
                    companyEmployerContribution += contribution;
                }
                if (!row.IsNull("VCER"))
                {
                    double contribution = (double)row["VCER"];
                    employerContribution        += contribution;
                    companyEmployerContribution += contribution;
                }
                if (!row.IsNull("PFundER"))
                {
                    double contribution = (double)row["PFundER"];
                    employerContribution        += contribution;
                    companyEmployerContribution += contribution;
                }
            }

            if (paymentHashTable.Count > 0)
            {
                groupRowCount++;

                rowPos = GenerateHierarchyTotal(workSheet, paymentTable, currentHierarchyGroup, currentEmployeeNo, paymentHashTable, netPayment, employerContribution, rowPos, detailStyle);

                paymentHashTable     = new Hashtable();
                netPayment           = 0;
                employerContribution = 0;
            }

            if (groupRowCount > 0)
            {
                rowPos = GenerateCompanyTotal(workSheet, paymentTable, groupRowCount, companyEmployerContribution, rowPos, subTotalStyle);
                companyTotalRowNumList.Add(rowPos);
            }
            if (companyTotalRowNumList.Count > 0)
            {
                rowPos = GenerateTotal(workSheet, paymentTable, companyTotalRowNumList, rowPos, subTotalStyle);
            }
            //workSheet.Cells.Merge(1, 1, 1, paymentTable.Columns.Count + 2);
            //workSheet.Rows[1].GetCell(1).Font.Bold = true;
            //workSheet.Rows[1].GetCell(1).Font.Height = 300;
            //workSheet.Rows[1].GetCell(1).HorizontalAlignment = org.in2bits.MyXls.HorizontalAlignments.Centered;
            workSheet.AddMergedRegion(new NPOI.SS.Util.CellRangeAddress(0, 0, 0, paymentTable.Columns.Count + 1));


            // checking the number of column to resize for better user view
            int resizeColumn = paymentTable.Columns.Count + 1;

            if (intHierarchyLevelID == STAFF_LEVEL_ID)
            {
                resizeColumn++;
            }

            for (int i = 0; i <= resizeColumn; i++)
            {
                //org.in2bits.MyXls.ColumnInfo columnInfo = new org.in2bits.MyXls.ColumnInfo(xlsDoc, workSheet);
                //workSheet.AddColumnInfo(columnInfo);
                //columnInfo.ColumnIndexStart = 0;
                //columnInfo.ColumnIndexEnd = (ushort)(paymentTable.Columns.Count + 2);
                //columnInfo.Width = 15 * 254;
                //columnInfo.Collapsed = true;
                workSheet.SetColumnWidth(i, 15 * 254);
            }
        }
Ejemplo n.º 47
0
        protected override void DoRecuperaRegistroDialog(System.Data.DataSet dataSet, object[] pk)
        {
            string sql = @"SELECT * FROM DRAtividade(NOLOCK) WHERE  CODIGOPRJ =@1 AND CodAtividade =@2 AND CodEtapa =@3";

            DBCon.Fill(dataSet.Tables["DRAtividade"], sql, pk);
        }
Ejemplo n.º 48
0
        void douser()
        {
            DataSet dt = new DataSet();

            Guid userGuid = System.Guid.NewGuid();

            string strpass = "******";

            string hashedPassword = Security.HashSHA1(strpass.ToString() + userGuid.ToString());

            SqlCommand _command;

            SqlDataAdapter _adp;

            System.Data.DataSet response = new System.Data.DataSet();

            using (SqlConnection connect = new SqlConnection(ConfigurationManager.ConnectionStrings["Registration2ConnectionString"].ConnectionString))
            {
                if (connect.State != ConnectionState.Closed)
                {
                    connect.Close();
                }

                connect.Open();
                _command = new SqlCommand("doInsertnewuser", connect)
                {
                    CommandType = CommandType.StoredProcedure
                };
                _command.Parameters.Add(new SqlParameter("@merchantcode", SqlDbType.VarChar)).Value =
                    (string)ViewState["MMerchantCode"];//ddlState.SelectedValue;
                _command.Parameters.Add(new SqlParameter("@LastName", SqlDbType.VarChar)).Value          = txtlast.Value.Trim();
                _command.Parameters.Add(new SqlParameter("@firstname", SqlDbType.VarChar)).Value         = txtfirst.Value.Trim();
                _command.Parameters.Add(new SqlParameter("@email", SqlDbType.VarChar)).Value             = txtemail.Value.Trim();
                _command.Parameters.Add(new SqlParameter("@PasswordHas", SqlDbType.VarChar)).Value       = hashedPassword;
                _command.Parameters.Add(new SqlParameter("@UserGuid", SqlDbType.UniqueIdentifier)).Value = userGuid;
                _command.CommandTimeout = 0;
                response.Clear();
                _adp = new SqlDataAdapter(_command);
                _adp.Fill(response);

                connect.Close();

                if (response.Tables[0].Rows[0]["returnCode"].ToString() == "00")
                {
                    //send email
                    SendLoginMail(txtemail.Value.ToString());
                    //display error message
                    string strmess = "Kindly check provide mail for confirmation";

                    Response.Write("<script language='javascript'>alert('" +
                                   Server.HtmlEncode(response.Tables[0].Rows[0]["returnMessage"].ToString()) + "')</script>");

                    Response.Write("<script language='javascript'>alert('" +
                                   Server.HtmlEncode(strmess.ToString()) + "')</script>");

                    lblerror.Text = response.Tables[0].Rows[0]["returnMessage"].ToString();

                    lblerror.Visible = true;
                }
                else
                {
                    //display error message
                    Response.Write("<script language='javascript'>alert('" +
                                   Server.HtmlEncode(response.Tables[0].Rows[0]["returnMessage"].ToString()) + "')</script>");
                    lblerror.Text    = response.Tables[0].Rows[0]["returnMessage"].ToString();
                    lblerror.Visible = true;
                }
            }
        }
Ejemplo n.º 49
0
 protected override void DoCriaDataSet(out System.Data.DataSet dataSet)
 {
     dataSet = new DSCadastro();
 }
Ejemplo n.º 50
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["AppLocation"] == null || Session.Count == 0 || Session["AppUserID"].ToString() == "")
        {
            IQCareMsgBox.Show("SessionExpired", this);
            Response.Redirect("~/frmlogin.aspx", true);
        }
        //(Master.FindControl("levelOneNavigationUserControl1").FindControl("lblRoot") as Label).Text = "Clinical Forms >> ";
        //(Master.FindControl("levelOneNavigationUserControl1").FindControl("lblheader") as Label).Text = "Patient History";
        //(Master.FindControl("levelTwoNavigationUserControl1").FindControl("lblformname") as Label).Text = "Existing Forms";

        (Master.FindControl("levelTwoNavigationUserControl1").FindControl("lblpntStatus") as Label).Text = (Session["PatientStatus"] != null) ? Convert.ToString(Session["PatientStatus"]) : Convert.ToString(Request.QueryString["sts"]);

        #region "Refresh Patient Records"
        IPatientHome PManager;
        PManager = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome, BusinessProcess.Clinical");
        System.Data.DataSet thePDS = PManager.GetPatientDetails(Convert.ToInt32(Session["PatientId"]), Convert.ToInt32(Session["SystemId"]), Convert.ToInt32(Session["TechnicalAreaId"]));
        //System.Data.DataSet thePDS = PManager.GetPatientDetails(Convert.ToInt32(Request.QueryString["PatientId"]), Convert.ToInt32(Session["SystemId"]));

        Session["PatientInformation"] = thePDS.Tables[0];
        #endregion

        IPatientHome PatientManager;
        PatientManager = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome, BusinessProcess.Clinical");

        try
        {
            if (!IsPostBack)
            {
                IFacilitySetup FacilityMaster = (IFacilitySetup)ObjectFactory.CreateInstance("BusinessProcess.Administration.BFacility, BusinessProcess.Administration");
                //theFacilityDS = FacilityMaster.GetFacilityList(Convert.ToInt32(Session["SystemId"]), 1001);
                //theFacilityDS = FacilityMaster.GetSystemBasedLabels(Convert.ToInt32(Session["SystemId"]), 1001, 0);
                //ViewState["FacilityDS"] = theFacilityDS;
                //SetPageLabels();
                //******************************************************//
                if (Session["PatientId"] == null || Convert.ToString(Session["PatientId"]) == "0")
                {
                    Session["PatientId"] = Request.QueryString["PatientId"];  //remove it after session of patient set on find add when patient selected from grid.
                }

                PId    = Convert.ToString(Session["PatientId"]);
                PtnSts = Convert.ToString(Session["PatientStatus"]); //Request.QueryString["sts"].ToString();
                if (Session["PatientId"] != null && Convert.ToInt32(Session["PatientId"]) != 0)
                {
                    PId = Session["PatientId"].ToString();
                }
                if (Session["PatientStatus"] != null)
                {
                    PtnSts = Session["PatientStatus"].ToString();
                }
                DataSet theDS = PatientManager.GetPatientHistory(Convert.ToInt32(PId));
                ViewState["theCFDT"]  = theDS.Tables[3].Copy();
                Session["FormStatus"] = "Pending";
                FormIQCare(theDS);

                if (Session["TechnicalAreaName"].ToString() == "ART Clinic")
                {
                    ucCCCMenu1.Visible = true;
                }
                else
                {
                    ucCCCMenu1.Visible = false;
                }
            }
        }

        catch (Exception err)
        {
            MsgBuilder theBuilder = new MsgBuilder();
            theBuilder.DataElements["MessageText"] = err.Message.ToString();
            IQCareMsgBox.Show("#C1", theBuilder, this);
            return;
        }
        finally
        {
            PatientManager = null;
        }
    }
Ejemplo n.º 51
0
 protected override void DoSalvaRegistro(System.Data.DataSet dataSet)
 {
 }
Ejemplo n.º 52
0
 /// <remarks/>
 public void ImportarDatosTablasDSAsync(int idDocumento, string strNombreDocumento, int idCompania, string strCompania, string strUsuario, string strClave, System.Data.DataSet dsFuenteDatos, string tsProceso, string Path, object userState)
 {
     if ((this.ImportarDatosTablasDSOperationCompleted == null))
     {
         this.ImportarDatosTablasDSOperationCompleted = new System.Threading.SendOrPostCallback(this.OnImportarDatosTablasDSOperationCompleted);
     }
     this.InvokeAsync("ImportarDatosTablasDS", new object[] {
         idDocumento,
         strNombreDocumento,
         idCompania,
         strCompania,
         strUsuario,
         strClave,
         dsFuenteDatos,
         tsProceso,
         Path
     }, this.ImportarDatosTablasDSOperationCompleted, userState);
 }
Ejemplo n.º 53
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["ref"] == null)
        {
            Response.Redirect("./moncomptetableaudebord_bis.aspx");
        }
        Membre member = (Membre)Session["Membre"];

        if (member != null && (member.STATUT != "nego" || member.STATUT != "ultranego"))
        {
        }
        else
        {
            Response.Redirect("./moncomptetableaudebord_bis.aspx");
        }

        isAdmin = (member.STATUT == "ultranego");

        Connexion c = new Connexion(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);

        c.Open();

        try
        {
            bien = c.exeRequetteOpen("SELECT * FROM Biens WHERE ref='" + Request.QueryString["ref"] + "'").Tables[0].Rows[0];
        }
        catch
        {
            Response.Redirect("./moncomptetableaudebord_bis.aspx");
            c.Close();
        }


        if (!IsPostBack)
        {
            int idNego    = (int)bien["idclient"];
            int honoraire = (int)bien["honoraires"];
            int prix      = (int)bien["prix de vente"];


            ((Label)Page.Master.FindControl("titrebandeau")).Text = "Proposer vente";
            //refBien.Text = Request.QueryString["ref"];
            TextBoxHonoraires.Text = honoraire.ToString();
            TextBoxPrix.Text       = prix.ToString();
            TextBoxSequestre.Text  = ((int)(int.Parse(TextBoxPrix.Text) * 5 / 100)).ToString();

            string codeiso = Code_iso("negomandat");

            DataRow negoMandat = c.exeRequetteOpen("SELECT Clients.* FROM Clients,Biens WHERE Biens.idclient = Clients.idclient AND Biens.ref = '" + Request.QueryString["ref"] + "'").Tables[0].Rows[0];
            nego.Text        = negoMandat["prenom_client"].ToString() + " " + negoMandat["nom_client"].ToString().ToUpper();
            negoadresse.Text = "<img height='20px'  src='../img_site/drapeau/" + codeiso + ".png'/>" + "<div class='tooltip'><span>" + "<img height='50px'  src='../img_site/drapeau/" + codeiso + ".png'/></span></div>" + "&nbsp;" + "<a href='https://www.google.fr/maps/place/" + negoMandat["adresse_client"] + " " + negoMandat["ville_client"].ToString() + "' target='_blank'><img style='cursor:pointer' src='../img_site/flat_round/monde.png' height='20px'/></a>" + " " + negoMandat["adresse_client"].ToString() + "<br/>" + "&nbsp;&nbsp;" + negoMandat["postal_client"].ToString() + ", " + negoMandat["ville_client"].ToString();
            negoTel.Text     = negoMandat["tel_client"].ToString();
            negoMail.Text    = "<a href='mailto:" + negoMandat["id_client"] + "'>" + negoMandat["id_client"] + "</a>";

            string temp  = DropDownListAcq.SelectedValue;
            string temp2 = DropDownListNotaire.SelectedValue;
            string req;
            string req2;

            if (member.STATUT == "ultranego")
            {
                req  = "SELECT id_acq,nom,prenom,tel,mail,code_postal,ville,idclient,adresse,pays FROM Acquereurs WHERE actif='actif' ORDER BY Nom ASC";
                req2 = "SELECT id_notaire,nom,prenom,adresse,code_postal,ville,mail,telephone,pays,fax FROM Notaires ORDER BY Nom ASC";
            }
            else
            {
                req  = "SELECT id_acq,nom,prenom,tel,mail,code_postal,ville,idclient,adresse,pays FROM Acquereurs WHERE actif='actif' AND idclient = " + member.IDCLIENT + " ORDER BY Nom ASC";
                req2 = "SELECT Notaires.id_notaire,nom,prenom,adresse,code_postal,ville,mail,telephone,pays,fax FROM Notaires INNER JOIN lien_clients_notaires ON lien_clients_notaires.id_notaire=Notaires.id_notaire WHERE lien_clients_notaires.id_client = " + member.IDCLIENT + " ORDER BY Nom ASC";
            }

            DataRowCollection listeAcquereur = c.exeRequetteOpen(req).Tables[0].Rows;
            foreach (DataRow acq in listeAcquereur)
            {
                string nomnegoacq = null, prenomnegoacq = null;

                string idacq = acq["id_acq"].ToString();

                req = "SELECT Clients.nom_client, Clients.prenom_client  FROM Acquereurs INNER JOIN Clients ON Acquereurs.idclient = Clients.idclient WHERE ((Acquereurs.id_acq)=" + idacq + ")";

                OdbcConnection connect = new OdbcConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);

                OdbcCommand requet = new OdbcCommand(req, connect);

                connect.Open();

                OdbcDataReader read = requet.ExecuteReader();

                while (read.Read())
                {
                    nomnegoacq = read["nom_client"].ToString().ToUpper();

                    prenomnegoacq = read["prenom_client"].ToString();
                }

                connect.Close();

                ListItem x = new ListItem(acq["nom"].ToString().ToUpper() + " " + acq["prenom"].ToString() + " (" + acq["ville"].ToString() + " - " + acq["code_postal"].ToString() + ") | négo associé: " + nomnegoacq + " " + prenomnegoacq);
                x.Attributes["tel"]         = acq["tel"].ToString();
                x.Attributes["mail"]        = acq["mail"].ToString();
                x.Attributes["idclient"]    = acq["idclient"].ToString();
                x.Attributes["nom"]         = acq["nom"].ToString().ToUpper();
                x.Attributes["prenom"]      = acq["prenom"].ToString();
                x.Attributes["adresse"]     = acq["adresse"].ToString();
                x.Attributes["ville"]       = acq["ville"].ToString();
                x.Attributes["code_postal"] = acq["code_postal"].ToString();
                x.Attributes["pays"]        = acq["pays"].ToString().ToUpper();
                x.Value = acq["id_acq"].ToString();

                req = "SELECT Pays.codeiso FROM Pays WHERE ((Pays.Titre_Pays)='" + acq["pays"].ToString() + "')";

                OdbcConnection connection = new OdbcConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);

                OdbcCommand requette = new OdbcCommand(req, connection);

                connection.Open();

                OdbcDataReader reader = requette.ExecuteReader();

                reader.Read();

                x.Attributes["codeiso"] = reader["codeiso"].ToString();

                connection.Close();

                DropDownListAcq.Items.Add(x);
            }

            if (Request.QueryString["acq"] != null)
            {
                DropDownListAcq.SelectedValue = Request.QueryString["acq"];
                nomacquereur.Text             = DropDownListAcq.SelectedItem.Attributes["nom"] + " " + DropDownListAcq.SelectedItem.Attributes["prenom"];
            }

            InformationNegoAcquereur();

            DataRowCollection listeNotaire = c.exeRequetteOpen(req2).Tables[0].Rows;
            foreach (DataRow not in listeNotaire)
            {
                ListItem y = new ListItem(not["nom"].ToString().ToUpper() + ", " + not["prenom"].ToString() + " (" + not["ville"].ToString() + " - " + not["code_postal"].ToString() + ")", not["id_notaire"].ToString());

                y.Attributes["nom"]         = not["nom"].ToString().ToUpper();
                y.Attributes["prenom"]      = not["prenom"].ToString();
                y.Attributes["adresse"]     = not["adresse"].ToString();
                y.Attributes["code_postal"] = not["code_postal"].ToString();
                y.Attributes["ville"]       = not["ville"].ToString();
                y.Attributes["mail"]        = not["mail"].ToString();
                y.Attributes["telephone"]   = not["telephone"].ToString();
                y.Attributes["pays"]        = not["pays"].ToString().ToUpper();
                y.Attributes["fax"]         = not["fax"].ToString();
                y.Attributes["id_notaire"]  = not["id_notaire"].ToString();

                if (not["pays"].ToString() != "")
                {
                    req = "SELECT Pays.codeiso FROM Pays WHERE ((Pays.Titre_Pays)='" + not["pays"].ToString() + "')";
                    //
                    OdbcConnection connection = new OdbcConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);

                    OdbcCommand requette = new OdbcCommand(req, connection);

                    connection.Open();

                    OdbcDataReader reader = requette.ExecuteReader();

                    reader.Read();

                    y.Attributes["codeiso"] = reader["codeiso"].ToString();

                    connection.Close();
                }

                DropDownListNotaire.Items.Add(y);
            }


            DropDownListNotaire.SelectedValue = temp2;


            if (Request.QueryString["id"] != null) //Consultation d'une fiche vente
            {
                System.Data.DataSet ds2 = c.exeRequetteOpen("Select * from Environnement");
                String racine_site      = (String)ds2.Tables[0].Rows[0]["Chemin_racine_site"];

                string filePathActe     = racine_site + "Ventes\\" + Request.QueryString["id"] + "_acte.pdf";
                string filePathPromesse = racine_site + "Ventes\\" + Request.QueryString["id"] + "_promesse.pdf";

                if (System.IO.File.Exists(filePathPromesse))
                {
                    oldPromesse.Text = "<span id='newPromesse'><a href='../Ventes/" + Request.QueryString["id"] + "_promesse.pdf' target='_blank'>Voir Fichier</a></span>";
                    filePromesse.Attributes["style"] += ";width: 140px;color:white;";
                }

                if (System.IO.File.Exists(filePathActe))
                {
                    oldActe.Text = "<span id='newActe'><a href='../Ventes/" + Request.QueryString["id"] + "_acte.pdf' target='_blank'>Voir Fichier</a></span>";
                    fileActe.Attributes["style"] += ";width: 140px;color:white;";
                }
                string val = "";
                if (Request.QueryString["id"] != null)
                {
                    val = Request.QueryString["id"];
                }
                else
                if (Request.QueryString["acq"] != null)
                {
                    val = Request.QueryString["acq"];
                }
                DataRow vente        = c.exeRequetteOpen("SELECT * FROM Ventes WHERE ID =" + val).Tables[0].Rows[0];
                bool    venteValidee = (bool)vente["valider_signature"];
                DropDownListAcq.SelectedValue = vente["id_acquereur"].ToString();

                ratioNegoMandat.Text = ((double)vente["taux_mandat"] * 100).ToString();
                ratioNegoVente.Text  = ((double)vente["taux_vente"] * 100).ToString();

                TextBoxPrix.Text       = vente["prix_vente"].ToString();
                TextBoxSequestre.Text  = vente["sequestre"].ToString();
                TextBoxHonoraires.Text = vente["commission"].ToString();

                // il faudrait plutot recuperer les infos du notaire dans la table  notaire ..
                notaireNom.Text           = vente["nom_notaire"].ToString();
                notairePrenom.Text        = vente["prenom_notaire"].ToString();
                notaireAdresse.Text       = vente["adresse_notaire"].ToString();
                notaireCPetville.Text     = vente["cp_notaire"].ToString() + ", " + vente["ville_notaire"].ToString();
                notaireTel.Text           = vente["tel_notaire"].ToString();
                notaireMail.Text          = vente["mail_notaire"].ToString();
                TextBoxDateCompromis.Text = vente["date_compromis"].ToString().Split(' ')[0];
                TextBoxDateSignature.Text = vente["date_signature"].ToString().Split(' ')[0];


                int idNegoMandataire = (int)vente["id_nego"];
                int idNegoVente      = (int)c.exeRequetteOpen("SELECT idclient FROM Acquereurs WHERE id_acq = " + vente["id_acquereur"].ToString()).Tables[0].Rows[0]["idclient"];

                saveVente.Visible = false;

                if ((!venteValidee && member.IDCLIENT == idNegoMandataire) || (!venteValidee && member.IDCLIENT == idNegoVente) || member.STATUT == "ultranego")
                {
                    updateVente.Visible = true;
                }
                else
                {
                    edit = false;
                    if (venteValidee)
                    {
                        msg.Text = "Vente validée, aucune modification possible.<br/>";
                    }
                }
            }

            c.Close();

            remplirTableauBien(Request.QueryString["ref"]);
        }
    }
Ejemplo n.º 54
0
        void btnSelect_Click(object sender, EventArgs e)
        {
            try
            {
                switch (Program.intCode)
                {
                case 13:    //Akwa Ibom state
                    if ((Int32)this.radioGroup1.EditValue == 1)
                    {
                        //and ([EReceiptsDate] BETWEEN '{1} 00:00:00' AND '{1} 23:59:59')
                        criteria = String.Format("SELECT Collection.tblCollectionReport.PaymentRefNumber,PayerName,Amount,CONVERT(VARCHAR, CONVERT(DATE, PaymentDate), 103) AS PaymentDate,AgencyName,Description,Collection.tblCollectionReport.EReceipts,CONVERT(VARCHAR, CONVERT(DATE, Receipt.tblCollectionReceipt.EReceiptsDate), 103)  AS [Receipts Date],PrintedBY,CONVERT(VARCHAR, CONVERT(DATE, IsPrintedDate), 103)  AS DatePrinted,ControlNumber ,Collection.tblCollectionReport.StationCode, ( SELECT StationName FROM Receipt.tblStation WHERE  Collection.tblCollectionReport.StationCode = Receipt.tblStation.StationCode ) AS StationName FROM Collection.tblCollectionReport LEFT JOIN Receipt.tblCollectionReceipt ON Collection.tblCollectionReport.PaymentRefNumber = Receipt.tblCollectionReceipt.PaymentRefNumber WHERE Collection.tblCollectionReport.EReceipts LIKE '%{0}%'", txtSearch.Text.Trim());
                    }
                    else if ((Int32)this.radioGroup1.EditValue == 2)
                    {
                        criteria = String.Format("SELECT Collection.tblCollectionReport.PaymentRefNumber,PayerName,Amount,CONVERT(VARCHAR, CONVERT(DATE, PaymentDate), 103) AS PaymentDate,AgencyName,Description,Collection.tblCollectionReport.EReceipts,CONVERT(VARCHAR, CONVERT(DATE, Receipt.tblCollectionReceipt.EReceiptsDate), 103)  AS [Receipts Date],PrintedBY,CONVERT(VARCHAR, CONVERT(DATE, IsPrintedDate), 103)  AS DatePrinted,ControlNumber ,Collection.tblCollectionReport.StationCode, ( SELECT StationName FROM Receipt.tblStation WHERE  Collection.tblCollectionReport.StationCode = Receipt.tblStation.StationCode ) AS StationName FROM Collection.tblCollectionReport LEFT JOIN Receipt.tblCollectionReceipt ON Collection.tblCollectionReport.PaymentRefNumber = Receipt.tblCollectionReceipt.PaymentRefNumber WHERE Collection.tblCollectionReport.PaymentRefNumber LIKE '%{0}%'", txtSearch.Text.Trim());
                    }
                    else if ((Int32)this.radioGroup1.EditValue == 3)
                    {
                        //this.label1.Text = "Payer Name";
                        criteria = String.Format("SELECT Collection.tblCollectionReport.PaymentRefNumber,PayerName,Amount,CONVERT(VARCHAR, CONVERT(DATE, PaymentDate), 103) AS PaymentDate,AgencyName,Description,Receipt.tblCollectionReceipt.EReceipts,CONVERT(VARCHAR, CONVERT(DATE, Receipt.tblCollectionReceipt.EReceiptsDate), 103)  AS [Receipts Date],PrintedBY,CONVERT(VARCHAR, CONVERT(DATE, IsPrintedDate), 103)  AS DatePrinted,ControlNumber ,Collection.tblCollectionReport.StationCode, ( SELECT StationName FROM Receipt.tblStation WHERE  Collection.tblCollectionReport.StationCode = Receipt.tblStation.StationCode ) AS StationName FROM Collection.tblCollectionReport left JOIN Receipt.tblCollectionReceipt ON Collection.tblCollectionReport.PaymentRefNumber = Receipt.tblCollectionReceipt.PaymentRefNumber WHERE Collection.tblCollectionReport.PayerName Like '%{0}%'", txtSearch.Text.Trim());
                    }
                    else if ((Int32)this.radioGroup1.EditValue == 4)
                    {
                        criteria = String.Format("SELECT Collection.tblCollectionReport.PaymentRefNumber,PayerName,Amount,CONVERT(VARCHAR, CONVERT(DATE, PaymentDate), 103) AS PaymentDate,AgencyName,Description,Collection.tblCollectionReport.EReceipts,CONVERT(VARCHAR, CONVERT(DATE, Receipt.tblCollectionReceipt.EReceiptsDate), 103)  AS [Receipts Date],PrintedBY,CONVERT(VARCHAR, CONVERT(DATE, IsPrintedDate), 103)  AS DatePrinted,ControlNumber ,Collection.tblCollectionReport.StationCode, ( SELECT StationName FROM Receipt.tblStation WHERE  Collection.tblCollectionReport.StationCode = Receipt.tblStation.StationCode ) AS StationName FROM Collection.tblCollectionReport LEFT JOIN Receipt.tblCollectionReceipt ON Collection.tblCollectionReport.PaymentRefNumber = Receipt.tblCollectionReceipt.PaymentRefNumber WHERE DepositSlipNumber Like '%{0}%'", txtSearch.Text.Trim());
                    }
                    break;

                case 20:    //detla state
                    if ((Int32)this.radioGroup1.EditValue == 1)
                    {
                        //and ([EReceiptsDate] BETWEEN '{1} 00:00:00' AND '{1} 23:59:59')
                        criteria = String.Format("SELECT Collection.tblCollectionReport.PaymentRefNumber,PayerName,Amount,CONVERT(VARCHAR, CONVERT(DATE, PaymentDate), 103) AS PaymentDate,AgencyName,Description,Collection.tblCollectionReport.EReceipts,CONVERT(VARCHAR, CONVERT(DATE, Receipt.tblCollectionReceipt.EReceiptsDate), 103)  AS [Receipts Date],PrintedBY,CONVERT(VARCHAR, CONVERT(DATE, IsPrintedDate), 103)  AS DatePrinted,Collection.tblCollectionReport.ControlNumber ,Collection.tblCollectionReport.StationCode, ( SELECT StationName FROM Receipt.tblStation WHERE  Collection.tblCollectionReport.StationCode = Receipt.tblStation.StationCode ) AS StationName FROM Collection.tblCollectionReport LEFT JOIN Receipt.tblCollectionReceipt ON Collection.tblCollectionReport.PaymentRefNumber = Receipt.tblCollectionReceipt.PaymentRefNumber WHERE Collection.tblCollectionReport.EReceipts LIKE '%{0}%' and Collection.tblCollectionReport.PaymentDate >= '{1}' And Collection.tblCollectionReport.PaymentDate <= '{2}'", txtSearch.Text.Trim(), string.Format("{0:MM/dd/yyy 00:00:00}", dtpDate.Value), string.Format("{0:MM/dd/yyy 23:59:59}", dtpenddate.Value));
                    }
                    else if ((Int32)this.radioGroup1.EditValue == 2)
                    {
                        criteria = String.Format("SELECT Collection.tblCollectionReport.PaymentRefNumber,PayerName,Amount,CONVERT(VARCHAR, CONVERT(DATE, PaymentDate), 103) AS PaymentDate,AgencyName,Description,Collection.tblCollectionReport.EReceipts,CONVERT(VARCHAR, CONVERT(DATE, Receipt.tblCollectionReceipt.EReceiptsDate), 103)  AS [Receipts Date],PrintedBY,CONVERT(VARCHAR, CONVERT(DATE, IsPrintedDate), 103)  AS DatePrinted,Collection.tblCollectionReport.ControlNumber ,Collection.tblCollectionReport.StationCode, ( SELECT StationName FROM Receipt.tblStation WHERE  Collection.tblCollectionReport.StationCode = Receipt.tblStation.StationCode ) AS StationName FROM Collection.tblCollectionReport LEFT JOIN Receipt.tblCollectionReceipt ON Collection.tblCollectionReport.PaymentRefNumber = Receipt.tblCollectionReceipt.PaymentRefNumber WHERE Collection.tblCollectionReport.PaymentRefNumber LIKE '%{0}%' And Collection.tblCollectionReport.PaymentDate >= '{1}' And Collection.tblCollectionReport.PaymentDate <= '{2}'", txtSearch.Text.Trim(), string.Format("{0:MM/dd/yyy 00:00:00}", dtpDate.Value), string.Format("{0:MM/dd/yyy 23:59:59}", dtpenddate.Value));
                    }
                    else if ((Int32)this.radioGroup1.EditValue == 3)
                    {
                        //this.label1.Text = "Payer Name";
                        criteria = String.Format("SELECT Collection.tblCollectionReport.PaymentRefNumber,PayerName,Amount,CONVERT(VARCHAR, CONVERT(DATE, PaymentDate), 103) AS PaymentDate,AgencyName,Description,Receipt.tblCollectionReceipt.EReceipts,CONVERT(VARCHAR, CONVERT(DATE, Receipt.tblCollectionReceipt.EReceiptsDate), 103)  AS [Receipts Date],PrintedBY,CONVERT(VARCHAR, CONVERT(DATE, IsPrintedDate), 103)  AS DatePrinted,Collection.tblCollectionReport.ControlNumber ,Collection.tblCollectionReport.StationCode, ( SELECT StationName FROM Receipt.tblStation WHERE  Collection.tblCollectionReport.StationCode = Receipt.tblStation.StationCode ) AS StationName FROM Collection.tblCollectionReport left JOIN Receipt.tblCollectionReceipt ON Collection.tblCollectionReport.PaymentRefNumber = Receipt.tblCollectionReceipt.PaymentRefNumber WHERE Collection.tblCollectionReport.PayerName Like '%{0}%' and Collection.tblCollectionReport.PaymentDate >= '{1}' And Collection.tblCollectionReport.PaymentDate <= '{2}' ", txtSearch.Text.Trim(), string.Format("{0:MM/dd/yyy 00:00:00}", dtpDate.Value), string.Format("{0:MM/dd/yyy 23:59:59}", dtpenddate.Value));
                    }
                    else if ((Int32)this.radioGroup1.EditValue == 4)
                    {
                        criteria = String.Format("SELECT Collection.tblCollectionReport.PaymentRefNumber,PayerName,Amount,CONVERT(VARCHAR, CONVERT(DATE, PaymentDate), 103) AS PaymentDate,AgencyName,Description,Collection.tblCollectionReport.EReceipts,CONVERT(VARCHAR, CONVERT(DATE, Receipt.tblCollectionReceipt.EReceiptsDate), 103)  AS [Receipts Date],PrintedBY,CONVERT(VARCHAR, CONVERT(DATE, IsPrintedDate), 103)  AS DatePrinted,Collection.tblCollectionReport.ControlNumber ,Collection.tblCollectionReport.StationCode, ( SELECT StationName FROM Receipt.tblStation WHERE  Collection.tblCollectionReport.StationCode = Receipt.tblStation.StationCode ) AS StationName FROM Collection.tblCollectionReport LEFT JOIN Receipt.tblCollectionReceipt ON Collection.tblCollectionReport.PaymentRefNumber = Receipt.tblCollectionReceipt.PaymentRefNumber WHERE  Collection.tblCollectionReport.PaymentDate >= '{0}' And Collection.tblCollectionReport.PaymentDate <= '{1}'   AND DepositSlipNumber Like '%{2}%'", string.Format("{0:MM/dd/yyy 00:00:00}", dtpDate.Value), string.Format("{0:MM/dd/yyy 23:59:59}", dtpenddate.Value), txtSearch.Text.Trim());
                    }
                    break;

                case 37:    //ogun state
                    if ((Int32)this.radioGroup1.EditValue == 1)
                    {
                        //and ([EReceiptsDate] BETWEEN '{1} 00:00:00' AND '{1} 23:59:59')
                        criteria = String.Format("SELECT Collection.tblCollectionReport.PaymentRefNumber,PayerName,Amount,CONVERT(VARCHAR, CONVERT(DATE, PaymentDate), 103) AS PaymentDate,AgencyName,Description,Collection.tblCollectionReport.EReceipts,CONVERT(VARCHAR, CONVERT(DATE, Receipt.tblCollectionReceipt.EReceiptsDate), 103)  AS [Receipts Date],PrintedBY,CONVERT(VARCHAR, CONVERT(DATE, IsPrintedDate), 103)  AS DatePrinted,ControlNumber ,Collection.tblCollectionReport.StationCode, ( SELECT StationName FROM Receipt.tblStation WHERE  Collection.tblCollectionReport.StationCode = Receipt.tblStation.StationCode ) AS StationName FROM Collection.tblCollectionReport LEFT JOIN Receipt.tblCollectionReceipt ON Collection.tblCollectionReport.PaymentRefNumber = Receipt.tblCollectionReceipt.PaymentRefNumber WHERE Collection.tblCollectionReport.EReceipts LIKE '%{0}%' and Collection.tblCollectionReport.EReceiptsDate >= '{1}' And Collection.tblCollectionReport.EReceiptsDate <= '{2}'", txtSearch.Text.Trim(), string.Format("{0:MM/dd/yyy 00:00:00}", dtpDate.Value), string.Format("{0:MM/dd/yyy 23:59:59}", dtpenddate.Value));
                    }
                    else if ((Int32)this.radioGroup1.EditValue == 2)
                    {
                        criteria = String.Format("SELECT Collection.tblCollectionReport.PaymentRefNumber,PayerName,Amount,CONVERT(VARCHAR, CONVERT(DATE, PaymentDate), 103) AS PaymentDate,AgencyName,Description,Collection.tblCollectionReport.EReceipts,CONVERT(VARCHAR, CONVERT(DATE, Receipt.tblCollectionReceipt.EReceiptsDate), 103)  AS [Receipts Date],PrintedBY,CONVERT(VARCHAR, CONVERT(DATE, IsPrintedDate), 103)  AS DatePrinted,ControlNumber ,Collection.tblCollectionReport.StationCode, ( SELECT StationName FROM Receipt.tblStation WHERE  Collection.tblCollectionReport.StationCode = Receipt.tblStation.StationCode ) AS StationName FROM Collection.tblCollectionReport LEFT JOIN Receipt.tblCollectionReceipt ON Collection.tblCollectionReport.PaymentRefNumber = Receipt.tblCollectionReceipt.PaymentRefNumber WHERE Collection.tblCollectionReport.PaymentRefNumber LIKE '%{0}%' And Collection.tblCollectionReport.EReceiptsDate >= '{1}' And Collection.tblCollectionReport.EReceiptsDate <= '{2}'", txtSearch.Text.Trim(), string.Format("{0:MM/dd/yyy 00:00:00}", dtpDate.Value), string.Format("{0:MM/dd/yyy 23:59:59}", dtpenddate.Value));
                    }
                    else if ((Int32)this.radioGroup1.EditValue == 3)
                    {
                        //this.label1.Text = "Payer Name";
                        criteria = String.Format("SELECT Collection.tblCollectionReport.PaymentRefNumber,PayerName,Amount,CONVERT(VARCHAR, CONVERT(DATE, PaymentDate), 103) AS PaymentDate,AgencyName,Description,Receipt.tblCollectionReceipt.EReceipts,CONVERT(VARCHAR, CONVERT(DATE, Receipt.tblCollectionReceipt.EReceiptsDate), 103)  AS [Receipts Date],PrintedBY,CONVERT(VARCHAR, CONVERT(DATE, IsPrintedDate), 103)  AS DatePrinted,ControlNumber ,Collection.tblCollectionReport.StationCode, ( SELECT StationName FROM Receipt.tblStation WHERE  Collection.tblCollectionReport.StationCode = Receipt.tblStation.StationCode ) AS StationName FROM Collection.tblCollectionReport left JOIN Receipt.tblCollectionReceipt ON Collection.tblCollectionReport.PaymentRefNumber = Receipt.tblCollectionReceipt.PaymentRefNumber WHERE Collection.tblCollectionReport.PayerName Like '%{0}%' and Collection.tblCollectionReport.EReceiptsDate >= '{1}' And Collection.tblCollectionReport.EReceiptsDate <= '{2}' ", txtSearch.Text.Trim(), string.Format("{0:MM/dd/yyy 00:00:00}", dtpDate.Value), string.Format("{0:MM/dd/yyy 23:59:59}", dtpenddate.Value));
                    }
                    else if ((Int32)this.radioGroup1.EditValue == 4)
                    {
                        criteria = String.Format("SELECT Collection.tblCollectionReport.PaymentRefNumber,PayerName,Amount,CONVERT(VARCHAR, CONVERT(DATE, PaymentDate), 103) AS PaymentDate,AgencyName,Description,Collection.tblCollectionReport.EReceipts,CONVERT(VARCHAR, CONVERT(DATE, Receipt.tblCollectionReceipt.EReceiptsDate), 103)  AS [Receipts Date],PrintedBY,CONVERT(VARCHAR, CONVERT(DATE, IsPrintedDate), 103)  AS DatePrinted,ControlNumber ,Collection.tblCollectionReport.StationCode, ( SELECT StationName FROM Receipt.tblStation WHERE  Collection.tblCollectionReport.StationCode = Receipt.tblStation.StationCode ) AS StationName FROM Collection.tblCollectionReport LEFT JOIN Receipt.tblCollectionReceipt ON Collection.tblCollectionReport.PaymentRefNumber = Receipt.tblCollectionReceipt.PaymentRefNumber WHERE  Collection.tblCollectionReport.EReceiptsDate >= '{0}' And Collection.tblCollectionReport.EReceiptsDate <= '{1}'   AND DepositSlipNumber Like '%{2}%'", string.Format("{0:MM/dd/yyy 00:00:00}", dtpDate.Value), string.Format("{0:MM/dd/yyy 23:59:59}", dtpenddate.Value), txtSearch.Text.Trim());
                    }
                    break;

                case 40:    //oyo state
                    if ((Int32)this.radioGroup1.EditValue == 1)
                    {
                        //and ([EReceiptsDate] BETWEEN '{1} 00:00:00' AND '{1} 23:59:59')
                        criteria = String.Format("SELECT Collection.tblCollectionReport.PaymentRefNumber,PayerName,Amount,CONVERT(VARCHAR, CONVERT(DATE, PaymentDate), 103) AS PaymentDate,AgencyName,Description,Collection.tblCollectionReport.EReceipts,CONVERT(VARCHAR, CONVERT(DATE, Receipt.tblCollectionReceipt.EReceiptsDate), 103)  AS [Receipts Date],PrintedBY,CONVERT(VARCHAR, CONVERT(DATE, IsPrintedDate), 103)  AS DatePrinted,ControlNumber ,Collection.tblCollectionReport.StationCode, ( SELECT StationName FROM Receipt.tblStation WHERE  Collection.tblCollectionReport.StationCode = Receipt.tblStation.StationCode ) AS StationName FROM Collection.tblCollectionReport LEFT JOIN Receipt.tblCollectionReceipt ON Collection.tblCollectionReport.PaymentRefNumber = Receipt.tblCollectionReceipt.PaymentRefNumber WHERE Collection.tblCollectionReport.EReceipts LIKE '%{0}%' and Collection.tblCollectionReport.EReceiptsDate >= '{1}' And Collection.tblCollectionReport.EReceiptsDate <= '{2}'", txtSearch.Text.Trim(), string.Format("{0:MM/dd/yyy 00:00:00}", dtpDate.Value), string.Format("{0:MM/dd/yyy 23:59:59}", dtpenddate.Value));
                    }
                    else if ((Int32)this.radioGroup1.EditValue == 2)
                    {
                        criteria = String.Format("SELECT Collection.tblCollectionReport.PaymentRefNumber,PayerName,Amount,CONVERT(VARCHAR, CONVERT(DATE, PaymentDate), 103) AS PaymentDate,AgencyName,Description,Collection.tblCollectionReport.EReceipts,CONVERT(VARCHAR, CONVERT(DATE, Receipt.tblCollectionReceipt.EReceiptsDate), 103)  AS [Receipts Date],PrintedBY,CONVERT(VARCHAR, CONVERT(DATE, IsPrintedDate), 103)  AS DatePrinted,ControlNumber ,Collection.tblCollectionReport.StationCode, ( SELECT StationName FROM Receipt.tblStation WHERE  Collection.tblCollectionReport.StationCode = Receipt.tblStation.StationCode ) AS StationName FROM Collection.tblCollectionReport LEFT JOIN Receipt.tblCollectionReceipt ON Collection.tblCollectionReport.PaymentRefNumber = Receipt.tblCollectionReceipt.PaymentRefNumber WHERE Collection.tblCollectionReport.PaymentRefNumber LIKE '%{0}%' And Collection.tblCollectionReport.EReceiptsDate >= '{1}' And Collection.tblCollectionReport.EReceiptsDate <= '{2}'", txtSearch.Text.Trim(), string.Format("{0:MM/dd/yyy 00:00:00}", dtpDate.Value), string.Format("{0:MM/dd/yyy 23:59:59}", dtpenddate.Value));
                    }
                    else if ((Int32)this.radioGroup1.EditValue == 3)
                    {
                        //this.label1.Text = "Payer Name";
                        criteria = String.Format("SELECT Collection.tblCollectionReport.PaymentRefNumber,PayerName,Amount,CONVERT(VARCHAR, CONVERT(DATE, PaymentDate), 103) AS PaymentDate,AgencyName,Description,Receipt.tblCollectionReceipt.EReceipts,CONVERT(VARCHAR, CONVERT(DATE, Receipt.tblCollectionReceipt.EReceiptsDate), 103)  AS [Receipts Date],PrintedBY,CONVERT(VARCHAR, CONVERT(DATE, IsPrintedDate), 103)  AS DatePrinted,ControlNumber ,Collection.tblCollectionReport.StationCode, ( SELECT StationName FROM Receipt.tblStation WHERE  Collection.tblCollectionReport.StationCode = Receipt.tblStation.StationCode ) AS StationName FROM Collection.tblCollectionReport left JOIN Receipt.tblCollectionReceipt ON Collection.tblCollectionReport.PaymentRefNumber = Receipt.tblCollectionReceipt.PaymentRefNumber WHERE Collection.tblCollectionReport.PayerName Like '%{0}%' and Collection.tblCollectionReport.EReceiptsDate >= '{1}' And Collection.tblCollectionReport.EReceiptsDate <= '{2}' ", txtSearch.Text.Trim(), string.Format("{0:MM/dd/yyy 00:00:00}", dtpDate.Value), string.Format("{0:MM/dd/yyy 23:59:59}", dtpenddate.Value));
                    }
                    else if ((Int32)this.radioGroup1.EditValue == 4)
                    {
                        criteria = String.Format("SELECT Collection.tblCollectionReport.PaymentRefNumber,PayerName,Amount,CONVERT(VARCHAR, CONVERT(DATE, PaymentDate), 103) AS PaymentDate,AgencyName,Description,Collection.tblCollectionReport.EReceipts,CONVERT(VARCHAR, CONVERT(DATE, Receipt.tblCollectionReceipt.EReceiptsDate), 103)  AS [Receipts Date],PrintedBY,CONVERT(VARCHAR, CONVERT(DATE, IsPrintedDate), 103)  AS DatePrinted,ControlNumber ,Collection.tblCollectionReport.StationCode, ( SELECT StationName FROM Receipt.tblStation WHERE  Collection.tblCollectionReport.StationCode = Receipt.tblStation.StationCode ) AS StationName FROM Collection.tblCollectionReport LEFT JOIN Receipt.tblCollectionReceipt ON Collection.tblCollectionReport.PaymentRefNumber = Receipt.tblCollectionReceipt.PaymentRefNumber WHERE  Collection.tblCollectionReport.EReceiptsDate >= '{0}' And Collection.tblCollectionReport.EReceiptsDate <= '{1}'   AND DepositSlipNumber Like '%{2}%'", string.Format("{0:MM/dd/yyy 00:00:00}", dtpDate.Value), string.Format("{0:MM/dd/yyy 23:59:59}", dtpenddate.Value), txtSearch.Text.Trim());
                    }
                    break;

                case 32:    //kogi state
                    if ((Int32)this.radioGroup1.EditValue == 1)
                    {
                        //and ([EReceiptsDate] BETWEEN '{1} 00:00:00' AND '{1} 23:59:59')
                        criteria = String.Format("SELECT Collection.tblCollectionReport.PaymentRefNumber,PayerName,Amount,CONVERT(VARCHAR, CONVERT(DATE, PaymentDate), 103) AS PaymentDate,AgencyName,Description,Collection.tblCollectionReport.EReceipts,CONVERT(VARCHAR, CONVERT(DATE, Receipt.tblCollectionReceipt.EReceiptsDate), 103)  AS [Receipts Date],PrintedBY,CONVERT(VARCHAR, CONVERT(DATE, IsPrintedDate), 103)  AS DatePrinted,ControlNumber ,Collection.tblCollectionReport.StationCode, ( SELECT StationName FROM Receipt.tblStation WHERE  Collection.tblCollectionReport.StationCode = Receipt.tblStation.StationCode ) AS StationName FROM Collection.tblCollectionReport LEFT JOIN Receipt.tblCollectionReceipt ON Collection.tblCollectionReport.PaymentRefNumber = Receipt.tblCollectionReceipt.PaymentRefNumber WHERE Collection.tblCollectionReport.EReceipts LIKE '%{0}%' and Collection.tblCollectionReport.EReceiptsDate >= '{1}' And Collection.tblCollectionReport.EReceiptsDate <= '{2}'", txtSearch.Text.Trim(), string.Format("{0:MM/dd/yyy 00:00:00}", dtpDate.Value), string.Format("{0:MM/dd/yyy 23:59:59}", dtpenddate.Value));
                    }
                    else if ((Int32)this.radioGroup1.EditValue == 2)
                    {
                        criteria = String.Format("SELECT Collection.tblCollectionReport.PaymentRefNumber,PayerName,Amount,CONVERT(VARCHAR, CONVERT(DATE, PaymentDate), 103) AS PaymentDate,AgencyName,Description,Collection.tblCollectionReport.EReceipts,CONVERT(VARCHAR, CONVERT(DATE, Receipt.tblCollectionReceipt.EReceiptsDate), 103)  AS [Receipts Date],PrintedBY,CONVERT(VARCHAR, CONVERT(DATE, IsPrintedDate), 103)  AS DatePrinted,ControlNumber ,Collection.tblCollectionReport.StationCode, ( SELECT StationName FROM Receipt.tblStation WHERE  Collection.tblCollectionReport.StationCode = Receipt.tblStation.StationCode ) AS StationName FROM Collection.tblCollectionReport LEFT JOIN Receipt.tblCollectionReceipt ON Collection.tblCollectionReport.PaymentRefNumber = Receipt.tblCollectionReceipt.PaymentRefNumber WHERE Collection.tblCollectionReport.PaymentRefNumber LIKE '%{0}%' And Collection.tblCollectionReport.EReceiptsDate >= '{1}' And Collection.tblCollectionReport.EReceiptsDate <= '{2}'", txtSearch.Text.Trim(), string.Format("{0:MM/dd/yyy 00:00:00}", dtpDate.Value), string.Format("{0:MM/dd/yyy 23:59:59}", dtpenddate.Value));
                    }
                    else if ((Int32)this.radioGroup1.EditValue == 3)
                    {
                        //this.label1.Text = "Payer Name";
                        criteria = String.Format("SELECT Collection.tblCollectionReport.PaymentRefNumber,PayerName,Amount,CONVERT(VARCHAR, CONVERT(DATE, PaymentDate), 103) AS PaymentDate,AgencyName,Description,Receipt.tblCollectionReceipt.EReceipts,CONVERT(VARCHAR, CONVERT(DATE, Receipt.tblCollectionReceipt.EReceiptsDate), 103)  AS [Receipts Date],PrintedBY,CONVERT(VARCHAR, CONVERT(DATE, IsPrintedDate), 103)  AS DatePrinted,ControlNumber ,Collection.tblCollectionReport.StationCode, ( SELECT StationName FROM Receipt.tblStation WHERE  Collection.tblCollectionReport.StationCode = Receipt.tblStation.StationCode ) AS StationName FROM Collection.tblCollectionReport left JOIN Receipt.tblCollectionReceipt ON Collection.tblCollectionReport.PaymentRefNumber = Receipt.tblCollectionReceipt.PaymentRefNumber WHERE Collection.tblCollectionReport.PayerName Like '%{0}%' and Collection.tblCollectionReport.EReceiptsDate >= '{1}' And Collection.tblCollectionReport.EReceiptsDate <= '{2}' ", txtSearch.Text.Trim(), string.Format("{0:MM/dd/yyy 00:00:00}", dtpDate.Value), string.Format("{0:MM/dd/yyy 23:59:59}", dtpenddate.Value));
                    }
                    else if ((Int32)this.radioGroup1.EditValue == 4)
                    {
                        criteria = String.Format("SELECT Collection.tblCollectionReport.PaymentRefNumber,PayerName,Amount,CONVERT(VARCHAR, CONVERT(DATE, PaymentDate), 103) AS PaymentDate,AgencyName,Description,Collection.tblCollectionReport.EReceipts,CONVERT(VARCHAR, CONVERT(DATE, Receipt.tblCollectionReceipt.EReceiptsDate), 103)  AS [Receipts Date],PrintedBY,CONVERT(VARCHAR, CONVERT(DATE, IsPrintedDate), 103)  AS DatePrinted,ControlNumber ,Collection.tblCollectionReport.StationCode, ( SELECT StationName FROM Receipt.tblStation WHERE  Collection.tblCollectionReport.StationCode = Receipt.tblStation.StationCode ) AS StationName FROM Collection.tblCollectionReport LEFT JOIN Receipt.tblCollectionReceipt ON Collection.tblCollectionReport.PaymentRefNumber = Receipt.tblCollectionReceipt.PaymentRefNumber WHERE  Collection.tblCollectionReport.EReceiptsDate >= '{0}' And Collection.tblCollectionReport.EReceiptsDate <= '{1}'   AND DepositSlipNumber Like '%{2}%'", string.Format("{0:MM/dd/yyy 00:00:00}", dtpDate.Value), string.Format("{0:MM/dd/yyy 23:59:59}", dtpenddate.Value), txtSearch.Text.Trim());
                    }

                    break;

                default:
                    break;
                }

                if (radioGroup1.EditValue == null)
                {
                    Common.setEmptyField("Search Criteria, can't be empty", "Search Receipt");
                    return;
                }
                else
                {
                    SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);



                    using (var ds = new System.Data.DataSet())
                    {
                        using (SqlDataAdapter ada = new SqlDataAdapter(criteria, Logic.ConnectionString))
                        {
                            ada.SelectCommand.CommandTimeout = 0;

                            ada.Fill(ds, "table");
                        }
                        dt = ds.Tables[0];
                    }

                    if (dt != null && dt.Rows.Count > 0)
                    {
                        //gridControl4.DataSource = dt;
                        gridControl1.DataSource = dt;

                        gridView2.BestFitColumns();
                        layoutView1.Columns["Amount"].DisplayFormat.FormatType   = FormatType.Numeric;
                        layoutView1.Columns["Amount"].DisplayFormat.FormatString = "n2";
                        //layoutView1.
                        //layoutView1.Columns["Amount"].DisplayFormat.Forma
                        layoutView1.Columns["PaymentDate"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.DateTime;
                        layoutView1.Columns["PaymentDate"].DisplayFormat.FormatString = "dd/MM/yyyy";
                        layoutView1.Columns["DatePrinted"].DisplayFormat.FormatType   = DevExpress.Utils.FormatType.DateTime;
                        layoutView1.Columns["DatePrinted"].DisplayFormat.FormatString = "dd/MM/yyyy";
                        //layoutView1.bes
                        //gridView2.Columns["Amount"].DisplayFormat.FormatType = FormatType.Numeric;
                        //gridView2.Columns["Amount"].DisplayFormat.FormatString = "n2";
                        //gridView4.Columns["ID"].Visible = false;
                    }
                    else
                    {
                        Common.setMessageBox("No Record Found", Program.ApplicationName, 1);
                        return;
                    }
                }
            }
            finally
            {
                SplashScreenManager.CloseForm(false);
            }
        }
Ejemplo n.º 55
0
 public void GetAllBy(HPS.BLL.LadeCancelAssignmentBLL.BLLLadeCancelAssignment_T.LadeCancelAssignment_TField fieldName, Object value, ref System.Data.DataSet dataSet)
 {
     try
     {
         _dataObject.SelectByField(fieldName.ToString(), value, ref dataSet);
     }
     catch (System.Exception ex)
     {
         throw Hepsa.Core.Exception.HandleException.ChangeExceptionLanguage(ex, this);
     }
 }
Ejemplo n.º 56
0
 /// <remarks/>
 public void GenerarPlanoXMLAsync(int idDocumento, string strNombreDocumento, int idCompania, string strCompania, string strUsuario, string strClave, System.Data.DataSet dsFuenteDatos, string Path, string strResultado)
 {
     this.GenerarPlanoXMLAsync(idDocumento, strNombreDocumento, idCompania, strCompania, strUsuario, strClave, dsFuenteDatos, Path, strResultado, null);
 }
Ejemplo n.º 57
0
 /// <remarks/>
 public void GenerarPlanoXMLAsync(int idDocumento, string strNombreDocumento, int idCompania, string strCompania, string strUsuario, string strClave, System.Data.DataSet dsFuenteDatos, string Path, string strResultado, object userState)
 {
     if ((this.GenerarPlanoXMLOperationCompleted == null))
     {
         this.GenerarPlanoXMLOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGenerarPlanoXMLOperationCompleted);
     }
     this.InvokeAsync("GenerarPlanoXML", new object[] {
         idDocumento,
         strNombreDocumento,
         idCompania,
         strCompania,
         strUsuario,
         strClave,
         dsFuenteDatos,
         Path,
         strResultado
     }, this.GenerarPlanoXMLOperationCompleted, userState);
 }
Ejemplo n.º 58
0
 public string ImportarDatosTablasDS(int idDocumento, string strNombreDocumento, int idCompania, string strCompania, string strUsuario, string strClave, System.Data.DataSet dsFuenteDatos, string tsProceso, ref string Path)
 {
     object[] results = this.Invoke("ImportarDatosTablasDS", new object[] {
         idDocumento,
         strNombreDocumento,
         idCompania,
         strCompania,
         strUsuario,
         strClave,
         dsFuenteDatos,
         tsProceso,
         Path
     });
     Path = ((string)(results[1]));
     return((string)(results[0]));
 }
Ejemplo n.º 59
0
 /// <remarks/>
 public void ImportarDatosTablasDSAsync(int idDocumento, string strNombreDocumento, int idCompania, string strCompania, string strUsuario, string strClave, System.Data.DataSet dsFuenteDatos, string tsProceso, string Path)
 {
     this.ImportarDatosTablasDSAsync(idDocumento, strNombreDocumento, idCompania, strCompania, strUsuario, strClave, dsFuenteDatos, tsProceso, Path, null);
 }
Ejemplo n.º 60
-16
        public static int SaveRecord(string sql)
        {
            const int rv = 0;
            try
            {
                string connectionString = ConfigurationManager.ConnectionStrings["LA3Access"].ConnectionString;
                using (var conn = new OleDbConnection(connectionString))
                {
                    conn.Open();
                    var cmGetID = new OleDbCommand("SELECT @@IDENTITY", conn);
                    var comm = new OleDbCommand(sql, conn) { CommandType = CommandType.Text };
                    comm.ExecuteNonQuery();

                    var ds = new DataSet();
                    var adapt = new OleDbDataAdapter(cmGetID);
                    adapt.Fill(ds);
                    adapt.Dispose();
                    cmGetID.Dispose();

                    return int.Parse(ds.Tables[0].Rows[0][0].ToString());

                }
            }
            catch (Exception)
            {
            }
            return rv;
        }