public void ClientCaptureCallback
        (
            byte[] bgrData,
            int imageWidth,
            int imageHeight
        )
        {
            // Copy the captured data to a local buffer
            this.CopyDataFromCaptureDataToLocalBuffer(bgrData, imageWidth, imageHeight);

            // Process the image data
            this.ClassifyRegion( );

            // Update the associated texture
            GR gr = this.mGR;

            gr.glBindTexture(GR.GL_TEXTURE_2D, this.mTextureOpenGLHandleBGR256x256);

            gr.glTexSubImage2D
            (
                GR.GL_TEXTURE_2D,           // target
                0,                          // level
                0,                          // xoffset
                0,                          // yoffset
                256,                        // width
                256,                        // height
                GR.GL_BGR_EXT,              // format
                GR.GL_UNSIGNED_BYTE,        // type
                this.mTextureDataBGR256x256 // texel data
            );
        }
Example #2
0
 private void BtnRemoveRow_Click(object sender, RoutedEventArgs e)
 {
     if (GR.Rows > 0)
     {
         GR.RemoveRow();
     }
 }
Example #3
0
 public void UpdateRunnersBusinessFlowRunsList()
 {
     foreach (GingerRunner GR in GingerRunners)
     {
         GR.UpdateBusinessFlowsRunList();
     }
 }
Example #4
0
        public void UpdateSize()
        {
            _CanRender = false;
            while (_IsRendering)
            {
            }
            switch (_DrawSize)
            {
            case DrawSize.Stretch:
                Screen_X = 0;
                Screen_Y = 0;
                Screen_W = Surface.Size.Width;
                Screen_H = Surface.Size.Height;
                break;

            case DrawSize.X1:
                Screen_X = (Surface.Size.Width / 2) - 128;
                Screen_Y = (Surface.Size.Height / 2) - (_ScanLines / 2);
                Screen_W = 256;
                Screen_H = _ScanLines;
                break;

            case DrawSize.X2:
                Screen_X = (Surface.Size.Width / 2) - 256;
                Screen_Y = (Surface.Size.Height / 2) - _ScanLines;
                Screen_W = 512;
                Screen_H = _ScanLines * 2;
                break;
            }
            GR = Surface.CreateGraphics();
            GR.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
            GR.Clear(Color.Black);
            CanRender = true;
        }
 public void SetRunnersEnv(ProjEnvironment defualtEnv, ObservableList <ProjEnvironment> allEnvs)
 {
     foreach (GingerRunner GR in Runners)
     {
         GR.SetExecutionEnvironment(defualtEnv, allEnvs);
     }
 }
Example #6
0
    protected void imgbtndiscard_Click(object sender, EventArgs e)
    {
        Int32     MsgId  = 0;
        DataTable dtMain = new DataTable();

        if (gridDelete.Rows.Count > 0)
        {
            foreach (GridViewRow GR in gridDelete.Rows)
            {
                CheckBox chk = (CheckBox)GR.FindControl("chkMsg");
                if (chk.Checked == true)
                {
                    Int32 MsgDetailId = Convert.ToInt32(gridDelete.DataKeys[GR.RowIndex].Value);
                    dtMain = clsMessage.SelectMsgIdUsingMsgDetailId(MsgDetailId);
                    if (dtMain.Rows.Count > 0)
                    {
                        MsgId = Convert.ToInt32(dtMain.Rows[0]["MsgId"].ToString());
                    }
                    bool MsgMasterDelete = clsMessage.DeleteMsgMaster(MsgId);
                    if (MsgMasterDelete == true)
                    {
                        lblmsg.Visible = true;
                        lblmsg.Text    = "Record deleted successfully";
                        SelectMsgforDeleteBox();
                    }
                }
            }
        }
    }
Example #7
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            foreach (GridViewRow GR in GridView1.Rows)
            {
                if (GR.RowType == DataControlRowType.DataRow)
                {
                    // You can also find grid view inside controls here
                    TextBox goods_id    = (TextBox)GR.FindControl("lbl_GoodId");
                    TextBox goods_unit  = (TextBox)GR.FindControl("lbl_ItemUnit");
                    TextBox goods_qty   = (TextBox)GR.FindControl("lbl_ItemQty");
                    TextBox goods_price = (TextBox)GR.FindControl("lbl_ItemPrice");


                    int    g_id    = Convert.ToInt32(goods_id.Text.ToString());
                    string g_unit  = Convert.ToString(goods_unit.Text.ToString());
                    string g_qty   = Convert.ToString(goods_qty.Text.ToString().Replace(",", "."));
                    string g_price = Convert.ToString(goods_price.Text.ToString().Replace(",", "."));


                    int LastInsertedId2  = 3261;
                    int transaction_type = 1;
                    con.Open();
                    string     str3    = "insert into tenders_items (waybill_id, goods_id, unit_name, quantity, price, tr_type) Values ('" + LastInsertedId2 + "', '" + g_id + "', N'" + g_unit + "', '" + g_qty + "', '" + g_price + "', '" + transaction_type + "')";
                    SqlCommand strCmd3 = new SqlCommand(str3, con);
                    strCmd3.ExecuteNonQuery();
                    con.Close();
                }
            }
        }
Example #8
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            int amount   = Convert.ToInt32(this.TextBox2.Text);
            int tagindex = -1;

            foreach (GridViewRow GR in this.GridView1.Rows)
            {
                CheckBox CB = (CheckBox)GR.FindControl("CheckBox1");
                if (CB.Checked)
                {
                    tagindex = GR.RowIndex;
                }
            }

            int bookamount = Convert.ToInt32(this.GridView1.Rows[tagindex].Cells[5].Text);
            int decrease   = bookamount - amount;

            DataManage dm = new DataManage();

            if (decrease > 0)
            {
                string sql = "update [Library].[library].[Book] set [Bamount] =" + decrease + "where [Bname] like '" + this.GridView1.Rows[tagindex].Cells[1].Text + "' and [Btype] like '" + this.GridView1.Rows[tagindex].Cells[2].Text + "' and [Bwriter] like '" + this.GridView1.Rows[tagindex].Cells[3].Text + "' and [Bpublish] like '" + this.GridView1.Rows[tagindex].Cells[4].Text + "'";
                dm.ExecuteSql(sql);
            }
            else
            {
                string sql = "delete from [Library].[library].[Book] where [Bname] like '" + this.GridView1.Rows[tagindex].Cells[1].Text + "' and [Btype] like '" + this.GridView1.Rows[tagindex].Cells[2].Text + "' and [Bwriter] like '" + this.GridView1.Rows[tagindex].Cells[3].Text + "' and [Bpublish] like '" + this.GridView1.Rows[tagindex].Cells[4].Text + "'";
                dm.ExecuteSql(sql);
            }

            Response.Write("<script>alert('出库成功!')</script>");
            databind();
        }
Example #9
0
 private void BtnRemoveColumn_Click(object sender, RoutedEventArgs e)
 {
     if (GR.Columns > 0)
     {
         GR.RemoveColumn();
     }
 }
Example #10
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            foreach (GridViewRow GR in GridView1.Rows)
            {
                if (GR.RowType == DataControlRowType.DataRow)
                {
                    // You can also find grid view inside controls here
                    Label MobileNum = (Label)GR.FindControl("mobile");

                    string str        = MobileNum.Text;
                    string other_nums = string.Empty;

                    if (MobileNum.Text != null)
                    {
                        for (int i = 1; i < str.Length; i++)
                        {
                            if (Char.IsDigit(str[i]))
                            {
                                other_nums += str[i];
                            }

                            var f_num     = str[0].ToString();
                            var first_num = Convert.ToString(f_num.Replace("8", "5"));
                            MobileNum.Text = first_num + other_nums;
                        }
                    }
                }
            }
        }
Example #11
0
 private void Selects(StateMachine.RuleStateEventArgs e)
 {
     try
     {
         GR.SelectCurrent(e.StateObject);
         MainStrip.SetLine(stateMachine.GetStrip);
         MainStrip.Select(stateMachine.Selected);
     }
     catch { }
 }
        public void OpenGLStarted(GRControl grControl)
        {
            GR gr = grControl.GetGR( );

            if (null == gr)
            {
                return;
            }
            // ...
        }
Example #13
0
        /// <summary>
        /// Método para ubicar puntos
        /// </summary>
        /// <param name="x">Coordenada del eje X</param>
        /// <param name="y">Coordenada del eje Y</param>
        /// <param name="img">Imagen</param>
        /// <returns>Imagen con los puntos</returns>
        private Image ubicar_puntos(int x, int y, Image img)
        {
            Graphics GR;
            Bitmap   BM      = new Bitmap(img);
            Pen      penTest = new System.Drawing.Pen(Brushes.Red);

            using (GR = Graphics.FromImage(img))
            {
                GR.DrawEllipse(penTest, x, y, 5, 5);
            }
            return(img);
        }
 private void SetupHeader(GR role, GridViewModel <GovernorModel> grid, GovernorDisplayPolicy displayPolicy, bool includeEndDate)
 {
     grid.AddHeaderCell("Name", displayPolicy.FullName, "name", "sortText")
     .AddHeaderCell("Shared with", role.OneOfThese(GR.LocalGovernor, GR.ChairOfLocalGoverningBody), "shared", "sortText")
     .AddHeaderCell("GID", displayPolicy.Id, "gid")
     .AddHeaderCell("Appointed by", displayPolicy.AppointingBodyId, "appointed", "sortText")
     .AddHeaderCell("From", displayPolicy.AppointmentStartDate, "fromDate", "sortDate")
     .AddHeaderCell(role == GR.Member ? "Date stepped down" : "To", includeEndDate, "toDate", "sortDate")
     .AddHeaderCell("Postcode", displayPolicy.PostCode)
     .AddHeaderCell("Date of birth", displayPolicy.DOB)
     .AddHeaderCell("Previous name", displayPolicy.PreviousFullName)
     .AddHeaderCell("Email address", displayPolicy.EmailAddress)
     .AddHeaderCell("Telephone", displayPolicy.TelephoneNumber);
 }
Example #15
0
        static void check_whq_global_totals(string min_code, string min_id, string perm_link,string period, ref GR gr)
        {
            //prod lmi_total_send_mult_disc
               // Console.WriteLine("");
            //onsole.WriteLine(perm_link + ":");
            foreach(string mcc in ids.mcc_code.Values ){
                var measurement = gr.GetMeasurements(min_id, period, period, "", "", false, "&filters[perm_link]=" + perm_link + "&filters[dimension]=" + mcc).FirstOrDefault();
                if (measurement.measurements.Count > 0) {

                Console.WriteLine(min_code + " " + mcc + ":" + measurement.measurements.First().Value);
                }else{
                    Console.WriteLine(min_code + " " + mcc + ": 0");
                }
            }
        }
Example #16
0
 private void BtnStart_Click(object sender, RoutedEventArgs e)
 {
     ResBox.Document.Blocks.Clear();
     if (string.IsNullOrWhiteSpace(WordInput.Text))
     {
         MessageBox.Show("Can't start with null word");
         return;
     }
     if (stateMachine.IsBusy)
     {
         MessageBox.Show("Machine is already running!");
         return;
     }
     stateMachine.Start(GR.GetCurrentStates(), GetPureSelSpeed());
 }
        private void Clear( )
        {
            mSTVideoCapture = null;

            mGR = null;

            mTextureDataBGR256x256         = null;
            mTextureOpenGLHandleBGR256x256 = 0;

            mVideoLUT256 = null;

            mProcessXMin           = 32;
            mProcessYMin           = 160;
            mProcessXMax           = 96;
            mProcessYMax           = 224;
            mCurrentClassification = (-1);
        }
Example #18
0
        public MainWindow()
        {
            InitializeComponent();
            MinWidth  = 800;
            MinHeight = 450;

            InitHandlers();
            stateMachine = new StateMachine();
            InitStrip();
            GR.Loaded += (s, e) => GR.SetControls(stateMachine.Rules);
            App.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException;

            if (!string.IsNullOrEmpty(Tools.StartupHelper))
            {
                stateMachine.Load(Tools.StartupHelper);
            }
        }
        private static void MakeFontTexture(GR gr)
        {
            byte[] rgbaBuffer = new byte[128 * 128 * 4];


            // fill in buffer with RGBA version of font pixels
            byte val = (byte)0;
            int  k   = 0;

            for (int j = 0; j < 128; j++)
            {
                for (int i = 0; i < 128; i++)
                {
                    k     = 4 * ((128 * (127 - j)) + i);
                    val   = Courier10FontBitmap[(16 * j) + (i >> 3)];
                    val <<= (i & 0x7); // 0..7
                    if (0 != (val & 0x80))
                    {
                        // opaque white
                        rgbaBuffer[k + 0] = 255; // R
                        rgbaBuffer[k + 1] = 255; // G
                        rgbaBuffer[k + 2] = 255; // B
                        rgbaBuffer[k + 3] = 255; // A
                    }
                    else
                    {
                        // transparent
                        rgbaBuffer[k + 0] = 0; // R
                        rgbaBuffer[k + 1] = 0; // G
                        rgbaBuffer[k + 2] = 0; // B
                        rgbaBuffer[k + 3] = 0; // A
                    }
                }
            }


            // create an OpenGL texture and transfer data to the texture
            int[] temp = new int[1];
            gr.glGenTextures(1, temp);
            mFontTextureName = temp[0];
            gr.glBindTexture(GR.GL_TEXTURE_2D, mFontTextureName);

            gr.glTexParameteri(GR.GL_TEXTURE_2D, GR.GL_TEXTURE_MAG_FILTER, GR.GL_NEAREST);
            gr.glTexParameteri(GR.GL_TEXTURE_2D, GR.GL_TEXTURE_MIN_FILTER, GR.GL_NEAREST);
            gr.glTexImage2D(GR.GL_TEXTURE_2D, 0, GR.GL_RGBA, 128, 128, 0, GR.GL_RGBA, GR.GL_UNSIGNED_BYTE, rgbaBuffer);
        }
Example #20
0
        private void BtnAddRow_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new Controls.PromptDialog()
            {
                Title = "Enter row name"
            };

            if (dialog.ShowDialog() == true)
            {
                if (string.IsNullOrEmpty(dialog.ResponseText))
                {
                    MessageBox.Show("Failed to add empty name", "Failed", MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                GR.AddRow(dialog.ResponseText[0]);
            }
        }
Example #21
0
        private void UpdateGrid()
        {
            int    IndexRow         = 0;
            int    IndexMes         = 0;
            string UnidValue        = "";
            int    CodProducto      = 0;
            string msgResultado     = string.Empty;
            int    CodProyecto      = HttpContext.Current.Session["codProyecto"] == null?0: Convert.ToInt32(HttpContext.Current.Session["codProyecto"]);
            int    TiempoProyeccion = HttpContext.Current.Session["TiempoProyeccion"] == null ? 0 : Convert.ToInt32(HttpContext.Current.Session["TiempoProyeccion"]);

            CodProducto = Request.QueryString["Id_Producto"] == null ? 0 : Convert.ToInt32(Request.QueryString["Id_Producto"]);
            CrearActualizarProductoVentas(TiempoProyeccion, CodProyecto, ref msgResultado, ref CodProducto);
            if (CodProducto > 0)
            {
                int TotalColl = _dttProductos.Columns.Count - 2;
                foreach (GridViewRow GR in GridView1.Rows)
                {
                    string QueryUpdate = "";
                    if (IndexRow < 12)
                    {
                        for (int IndexCol = 1; IndexCol <= TiempoProyeccion; IndexCol++)
                        {
                            string FieldAnio = _dttProductos.Columns[IndexCol].ColumnName;
                            FieldAnio = FieldAnio.Substring(3, 2).TrimStart();
                            string NomTextBox = "TextBox" + FieldAnio;
                            if (GR.RowType == DataControlRowType.DataRow)
                            {
                                string FieldMes = _dttProductos.Columns[IndexCol].ColumnName;
                                IndexMes = Convert.ToInt32(_dttProductos.Rows[IndexRow]["Periodos_"]);
                                TextBox TextBoxValue = (TextBox)GR.FindControl(NomTextBox);
                                TextBoxValue.Text = (TextBoxValue.Text == "" ? "0" : TextBoxValue.Text);
                                UnidValue         = TextBoxValue.Text.Replace(",", "");
                            }
                            QueryUpdate += "UPDATE ProyectoProductoUnidadesVentas SET Unidades =" + UnidValue + " WHERE Codproducto=" + CodProducto + " and  Mes=" + IndexMes + " and Ano=" + FieldAnio + "\n";
                        }
                        IndexRow++;
                        InsertUpdateProductos(QueryUpdate);
                    }
                }
                precios(CodProducto.ToString(), TiempoProyeccion);
            }
            ClientScriptManager cm = this.ClientScript;

            cm.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'> alert('" + msgResultado + "'); location.href = '../Proyecto/PProyectoMercadoProyecciones.aspx' </script>");
        }
Example #22
0
    protected void imgbtnmovetoInbox_Click(object sender, EventArgs e)
    {
        bool Gcheck          = false;
        bool UpdateMsgDetail = false;

        if (gridDelete.Rows.Count > 0)
        {
            foreach (GridViewRow GR in gridDelete.Rows)
            {
                CheckBox chk = (CheckBox)GR.FindControl("chkMsg");
                if (chk.Checked == true)
                {
                    Gcheck = true;
                    break;
                }
            }
            if (Gcheck == false)
            {
                lblmsg.Text    = "Please select atleast one deleted Message to move to Inbox.";
                lblmsg.Visible = true;
                return;
            }
            else
            {
                if (gridDelete.Rows.Count > 0)
                {
                    foreach (GridViewRow GR in gridDelete.Rows)
                    {
                        CheckBox chk = (CheckBox)GR.FindControl("chkMsg");
                        if (chk.Checked == true)
                        {
                            Int32 MsgDetailId = Convert.ToInt32(gridDelete.DataKeys[GR.RowIndex].Value);
                            UpdateMsgDetail = clsMessage.UpdateMsgDetail(MsgDetailId, 1);
                        }
                    }
                    if (UpdateMsgDetail == true)
                    {
                        lblmsg.Visible = true;
                        lblmsg.Text    = "Messages are Successfully moved to Inbox.";
                        SelectMsgforDeleteBox();
                    }
                }
            }
        }
    }
Example #23
0
    protected void imgbtndiscard_Click(object sender, EventArgs e)
    {
        bool Gcheck = false;

        if (gridDraft.Rows.Count > 0)
        {
            foreach (GridViewRow GR in gridDraft.Rows)
            {
                CheckBox chk = (CheckBox)GR.FindControl("chkMsg");
                if (chk.Checked == true)
                {
                    Gcheck = true;
                    break;
                }
            }
            if (Gcheck == false)
            {
                lblmsg.Text    = "Please select atleast one Draft Message to Delete.";
                pnlmsg.Visible = true;
                return;
            }
            else
            {
                bool MsgMasterDelete = false;
                foreach (GridViewRow GR in gridDraft.Rows)
                {
                    CheckBox chk = (CheckBox)GR.FindControl("chkMsg");
                    if (chk.Checked == true)
                    {
                        Int32 MsgId           = Convert.ToInt32(gridDraft.DataKeys[GR.RowIndex].Value);
                        bool  MsgDetailDelete = clsMessage.DeleteMsgDetail(MsgId);
                        bool  FileDelete      = clsMessage.DeleteMsgFileAttachDetail(MsgId);
                        MsgMasterDelete = clsMessage.DeleteMsgMaster(MsgId);
                    }
                }
                if (MsgMasterDelete == true)
                {
                    lblmsg.Visible = true;
                    pnlmsg.Visible = true;
                    lblmsg.Text    = "Message Deleted Successfully.";
                    SelectMsgforDraft();
                }
            }
        }
    }
Example #24
0
    protected void imgbtnsend_Click(object sender, EventArgs e)
    {
        bool Gcheck    = false;
        bool UpdateMsg = false;

        if (gridDraft.Rows.Count > 0)
        {
            foreach (GridViewRow GR in gridDraft.Rows)
            {
                CheckBox chk = (CheckBox)GR.FindControl("chkMsg");
                if (chk.Checked == true)
                {
                    Gcheck = true;
                    break;
                }
            }
            if (Gcheck == false)
            {
                lblmsg.Text    = "Please select atleast one Draft Message to send.";
                pnlmsg.Visible = true;
                return;
            }
            else
            {
                foreach (GridViewRow GR in gridDraft.Rows)
                {
                    CheckBox chk = (CheckBox)GR.FindControl("chkMsg");
                    if (chk.Checked == true)
                    {
                        Int32 MsgId           = Convert.ToInt32(gridDraft.DataKeys[GR.RowIndex].Value);
                        bool  UpdateMsgMaster = clsMessage.UpdateMsgMasterforDraftSend(MsgId);
                        UpdateMsg = clsMessage.UpdateMsgDetailusingMsgId(MsgId, 1);
                    }
                }
                if (UpdateMsg == true)
                {
                    pnlmsg.Visible = true;
                    lblmsg.Visible = true;
                    lblmsg.Text    = "Message Sent Successfully.";
                    SelectMsgforDraft();
                }
            }
        }
    }
        public void Terminate( )
        {
            if (null != this.mSTVideoCapture)
            {
                this.mSTVideoCapture.Terminate( );
            }

            if (0 != mTextureOpenGLHandleBGR256x256)
            {
                GR gr = this.mGR;

                // Delete OpenGL texture object
                int[] temp = new int[1];
                temp[0] = this.mTextureOpenGLHandleBGR256x256;
                gr.glDeleteTextures(1, temp);
            }

            this.Clear( );
        }
Example #26
0
        static void deleteAllMeasurements(string period_from, string period_to, ref GR gr, string mcc)
        {
            Console.WriteLine(mcc);
            var everything = gr.GetMeasurements("", period_from, period_to, "", "", false, "&filters[perm_link]=lmi_local%25&show_detail=true&filters[dimension]=" + mcc + "&per_page=100");

               //int i = 0;
            foreach (var row1 in everything)
            {
                Console.WriteLine("Deleting " + row1.PermLink);
                foreach (var row in row1.measurements.Where(c => c.CreatedBy == "46df52a6-e71e-11e3-a5a1-12768b82bfd5"))
                {
                    Console.Write(".");

                    gr.DeleteMeasuerment(row.ID);

                    //i++;
                }
            }
        }
Example #27
0
 protected void imgbtndiscard_Click(object sender, EventArgs e)
 {
     if (gridInbox.Rows.Count > 0)
     {
         foreach (GridViewRow GR in gridInbox.Rows)
         {
             CheckBox chk = (CheckBox)GR.FindControl("chkMsg");
             if (chk.Checked == true)
             {
                 Int32 MsgDetailId = Convert.ToInt32(gridInbox.DataKeys[GR.RowIndex].Value);
                 clsMessage.UpdateMsgDetail(MsgDetailId, 4);
                 lblmsg.Text    = "Message Discard Successfully";
                 lblmsg.Visible = true;
                 pnlmsg.Visible = true;
             }
         }
         SelectMsgforInbox();
     }
 }
Example #28
0
        protected void SaveWaybill_Click(object sender, ImageClickEventArgs e)
        {
            foreach (GridViewRow GR in GridView2.Rows)
            {
                if (GR.RowType == DataControlRowType.DataRow)
                {
                    // You can also find grid view inside controls here
                    HiddenField goods_id    = (HiddenField)GR.FindControl("HiddenField_GoodId");
                    Label       goods_unit  = (Label)GR.FindControl("lbl_ItemUnit");
                    Label       goods_qty   = (Label)GR.FindControl("lbl_ItemQty");
                    Label       goods_price = (Label)GR.FindControl("lbl_ItemPrice");

                    int    g_id    = Convert.ToInt32(goods_id.Value.TrimStart());
                    string g_unit  = Convert.ToString(goods_unit.Text.ToString());
                    string g_qty   = Convert.ToString(goods_qty.Text.ToString().Replace(",", "."));
                    string g_price = Convert.ToString(goods_price.Text.ToString().Replace(",", "."));

                    Response.Write("<script type='text/javascript'>alert('" + g_id + "')</script>");
                }
            }
        }
 protected void imgbtndiscard_Click(object sender, EventArgs e)
 {
     if (grdSentMailList.Rows.Count > 0)
     {
         foreach (GridViewRow GR in grdSentMailList.Rows)
         {
             CheckBox chk = (CheckBox)GR.FindControl("chkMsg");
             if (chk.Checked == true)
             {
                 Int32 MsgId = Convert.ToInt32(grdSentMailList.DataKeys[GR.RowIndex].Value);
                 bool  del   = clsMessage.UpdateMsgMasterforSendDeleteExt(MsgId, "Deleted");
                 if (del == true)
                 {
                     pnlmsg.Visible = true;
                     lblmsg.Text    = "Record Discard Successfully";
                     lblmsg.Visible = true;
                 }
             }
         }
         SelectMsgforSendBox();
     }
 }
Example #30
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        string str1 = "";

        con.Close();
        con.Open();
        string str = " SELECT DISTINCT COUNT(dbo.MassEmailDetail.BusinessEmailID) AS Expr1, dbo.MassEmailDetail.BusinessEmailID FROM dbo.MassEmailDetail INNER JOIN  dbo.MassemailMaster ON dbo.MassEmailDetail.MassemailMasterID = dbo.MassemailMaster.MassemailMasterID GROUP BY dbo.MassEmailDetail.BusinessEmailID ";

        str = "SELECT DISTINCT COUNT(dbo.MassEmailDetail.BusinessEmailID) AS Expr1, dbo.MassEmailDetail.BusinessEmailID, dbo.MassemailMaster.date, dbo.MassemailMaster.Message, dbo.MassemailMaster.AttachmentURL, dbo.MassemailMaster.MasterEmailSentSubject, dbo.MassemailMaster.Mail_message_FormatName FROM            dbo.MassEmailDetail INNER JOIN    dbo.MassemailMaster ON dbo.MassEmailDetail.MassemailMasterID = dbo.MassemailMaster.MassemailMasterID GROUP BY dbo.MassEmailDetail.BusinessEmailID, dbo.MassemailMaster.date, dbo.MassemailMaster.Message, dbo.MassemailMaster.AttachmentURL, dbo.MassemailMaster.MasterEmailSentSubject, dbo.MassemailMaster.Mail_message_FormatName";
        SqlCommand     cmd = new SqlCommand(str, con);
        SqlDataAdapter da  = new SqlDataAdapter(str, con);
        DataTable      dt  = new DataTable();

        da.Fill(dt);
        GridView2.DataSource = dt;
        GridView2.DataBind();

        con.Close();
        con.Open();
        foreach (GridViewRow GR in GridView1.Rows)
        {
            CheckBox chk                         = (CheckBox)GR.FindControl("chkSelect");
            Label    BusinessEmailID             = (Label)GR.FindControl("lbl_email");
            Label    lbl_Message                 = (Label)GR.FindControl("lbl_Message");
            Label    lbl_Master_EmailSentSubject = (Label)GR.FindControl("lbl_Master_EmailSentSubject");
            if (chk.Checked == true)
            {
                Session["lbl_Message"] = lbl_Message.Text;
                Session["lbl_Master_EmailSentSubject"] = lbl_Master_EmailSentSubject.Text;
                mail = BusinessEmailID.Text;
                SendMail();
                con.Close();
                con.Open();
            }
        }

        lbl_msg.Text = "Mail Send Successfully";
    }
Example #31
0
        protected void btntoExcel_Click(object sender, EventArgs e)
        {
            MyNewTest();

            foreach (GridViewRow GR in GridView2.Rows)
            {
                if (GR.RowType == DataControlRowType.DataRow)
                {
                    // You can also find grid view inside controls here

                    TextBox goods_name  = (TextBox)GR.FindControl("lbl_ItemName");
                    TextBox goods_code  = (TextBox)GR.FindControl("lbl_ItemCode");
                    TextBox goods_qty   = (TextBox)GR.FindControl("lbl_ItemQty");
                    TextBox goods_price = (TextBox)GR.FindControl("lbl_ItemPrice");



                    string g_name  = Convert.ToString(goods_name.Text.ToString());
                    string g_code  = Convert.ToString(goods_code.Text.ToString());
                    string g_qty   = Convert.ToString(goods_qty.Text.ToString().Replace(",", "."));
                    string g_price = Convert.ToString(goods_price.Text.ToString().Replace(",", "."));



                    using (OleDbConnection conn = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Expoted_Files\\gridview.xls;Extended Properties='Excel 12.0;HDR=Yes'"))
                    {
                        conn.Open();
                        OleDbCommand cmd = new OleDbCommand("INSERT INTO [Sheet1$] ([name], [code], [qty], [price]) values ('" + g_name + "', '" + g_code + "', '" + g_qty + "', '" + g_price + "')", conn);
                        exp = cmd.ExecuteNonQuery();
                    }
                }
            }
            if (exp > 0)
            {
                Response.Write("<script type='text/javascript'>alert('Excel-ის ფაილის ექსპორტი განხორციელდა წარმატებით C: დისკზე, დირექტორიაში Expoted_Files')</script>");
            }
        }
    protected void buttondual_Click(object sender, EventArgs e)
    {
        if (buttondual.Text == "Select")
        {
            foreach (GridViewRow GR in GridView2.Rows)
            {
                CheckBox chk = (CheckBox)GR.FindControl("chkParty");

                if (GR.RowIndex == 0)
                {
                    chk.Enabled     = false;
                    buttondual.Text = "Go";
                }
                else
                {
                    chk.Enabled     = true;
                    buttondual.Text = "Go";
                }
            }
        }

        if (buttondual.Text == "Go")
        {
            foreach (GridViewRow GR in GridView2.Rows)
            {
                CheckBox chk = (CheckBox)GR.FindControl("chkParty");

                if (chk.Checked == true)
                {
                    Label lbl1 = (Label)GR.FindControl("Label13");
                    ViewState["lb"] = lbl1.Text;

                    SelectMsgforSendBox();
                }
            }
        }
    }
        public override TimedPlay TimedPlayOnRoll(GameState gamestate, List<GR.Gambling.Backgammon.Tools.PlayHint> hints, GR.Gambling.Backgammon.Venue.VenueUndoMethod undo_method)
        {
            bool is_race = gamestate.Board.IsPureRace();
            bool is_bearoff = (gamestate.Board.LastChequer(gamestate.PlayerOnRoll) < 6);

            int total_sleep_before_first = 0;
            if (gamestate.Board.CapturedCount(gamestate.PlayerOnRoll) != hints[0].Play.Count)
            {
                if (!is_race)
                {
                    total_sleep_before_first += random.Next(750, 1750);

                    if (random.Next(10) == 0)
                        total_sleep_before_first += random.Next(2500);
                }
                else
                {
                    if (!is_bearoff)
                        total_sleep_before_first += random.Next(250, 750);

                    if (random.Next(20) == 0)
                        total_sleep_before_first += random.Next(1000);
                    if (random.Next(40) == 0)
                        total_sleep_before_first += random.Next(2500);
                    if (random.Next(60) == 0)
                        total_sleep_before_first += random.Next(5000);
                }
            }

            int last_slot = -5;
            int last_dest = -5;

            int on_bar = gamestate.Board.CapturedCount(gamestate.PlayerOnRoll);

            TimedPlay play = new TimedPlay();

            int[] dice = gamestate.Dice;
            Play p = hints[0].Play;
            for (int i = 0; i < p.Count; i++)
            {
                int slot = p[i].From;
                int before = 0;
                int after = 0;
                int die = p[i].From - p[i].To;

                if (!(die == dice[0] || die == dice[1]))
                    die = System.Math.Max(dice[0], dice[1]);

                if (i == 0)
                    before += total_sleep_before_first;

                if (i == (p.Count - 1) && random.Next(15) == 0)
                    after += random.Next(300, 1300);

                if (on_bar > 0)
                {
                    if (random.Next(8) == 0)
                        before += random.Next(500, 1000);
                }
                else if (!is_bearoff && i > 0 && slot != last_slot && (slot - die >= 0) && slot != last_dest && !p[i].IsEnter && (slot - die != last_dest))
                {
                    int diff = System.Math.Abs(slot - last_slot);

                    if ((last_slot >= 12 && slot < 12) || (slot >= 12 && last_slot < 12))
                        diff = 10;

                    if (diff <= 1)
                        before += random.Next(25, 75);
                    else if (diff <= 3)
                        before += random.Next(50, 350);
                    else if (diff <= 6)
                        before += random.Next(100, 500);
                    else
                        before += random.Next(150, 900);
                }
                else
                {
                }

                play.Add(new TimedMove(hints[0].Play[i], before, after));

                last_slot = slot;
                last_dest = p[i].To;
                on_bar--;
            }

            return play;
        }
Example #34
0
        static void push_whq_data(Boolean stage = false, Boolean dev = false, int months = 5, Boolean reset = false, Boolean new_model_only = false)
        {
            var d = new WHQtoGR.App_Code.whq2grDataContext();
            GR gr = null;
            ids = new gr_ids(stage);
            string whq_system = "";
            if (stage)
            {
                gr = new GR(ConfigurationManager.AppSettings["whq_stage_api_key"], ConfigurationManager.AppSettings["gr_stage_server"], false);
               // gr.MeasApi = "http://*****:*****@"SELECT
                    CAST( DATE_FORMAT(`gma_directorreport`.`directorreport_endDate`, '%Y-%m-01') as DATE) AS `Date`,
                    `gma_locationtrans`.`location_name` AS `Area`,
                    `gma_organizationdata`.`organization_countryCode` AS `Country`,
                    `gma_measurementlbl`.`measurementlbl_name` AS `LMI`,
                    `gma_strategylbl`.`strategylbl_name` AS `MCC`,
                    SUM( `gma_directordata`.`directordata_value` ) AS `Value`
                FROM
                    `gma_directordata`
                    JOIN `gma_directorreport` ON `gma_directordata`.`directorreport_id` = `gma_directorreport`.`directorreport_id`
                    JOIN `gma_measurement` ON `gma_directordata`.`measurement_id` = `gma_measurement`.`measurement_id`
                    JOIN `gma_newmeasurementdetails` ON `gma_measurement`.`measurement_details_id` = `gma_newmeasurementdetails`.`measurement_details_id`
                    JOIN `gma_measurementlbl` ON `gma_measurement`.`measurementlbl_id` = `gma_measurementlbl`.`measurementlbl_id`
                    JOIN `gma_organizationdata` ON `gma_measurement`.`organization_id` = `gma_organizationdata`.`organization_id`
                    JOIN `gma_strategydata` ON `gma_newmeasurementdetails`.`strategy_id` = `gma_strategydata`.`strategy_id`
                    JOIN `gma_strategylbl` ON `gma_strategydata`.`strategylbl_id` = `gma_strategylbl`.`strategylbl_id`
                    JOIN `gma_locationtrans` ON `gma_organizationdata`.`location_id` = `gma_locationtrans`.`location_id`
                WHERE
                    `gma_organizationdata`.`version_id` = 2
                    AND `gma_strategydata`.`version_id` = 2
                    AND `gma_locationtrans`.`language_id` = 1
                    AND `gma_organizationdata`.`organization_leftIndex` + 1 = `gma_organizationdata`.`organization_rightIndex`
                    AND MONTH(`gma_directorreport`.`directorreport_endDate`)= MONTH(CURDATE() - INTERVAL " + i + @" MONTH )
            AND YEAR(`gma_directorreport`.`directorreport_endDate`)= YEAR(CURDATE() - INTERVAL " + i + @" MONTH )
            and Not `gma_locationtrans`.`location_name`  = 'NONE' and Not `gma_locationtrans`.`location_name`  = 'TEST'
            And `gma_directordata`.`directordata_value`  >0
                GROUP BY
                    `Date`,
                    `Area`,
                    `Country`,
                    `LMI`,
                    `MCC`";

                    var dt = new DataTable();
                    var da = new MySqlDataAdapter(cmd);
                    da.Fill(dt);

                    //get all measurements

                   // Console.WriteLine(dt.Rows.Count);

                    var rows = dt.AsEnumerable().Where(row => (d.wierd_countries.Where(c => c.whq_code == row["Country"].ToString() && c.min_code == null).Count() == 0) && ids.m.ContainsKey(row["LMI"].ToString()) && (d.mid_lookups.Where(c => (c.country == row["Country"].ToString()) && c.etl && (c.stage == stage)).Count() == 0 || (row["LMI"].ToString().Contains("actualreportingnodes") || row["LMI"].ToString().Contains("actualreportingnodes")))).ToArray();
                    //Console.WriteLine("before: " + rows.Where(row => row["Country"].ToString() == "EGY").Count().ToString());

                    //filter out ETL Active rows and only

                    //now some tests

                    int delta = rows.Count() / 10;
                    int count = 0;
                    var flat_list = new Dictionary<string, double>();

                    var flat_list_mt = new Dictionary<string, string>(); //The flatlist contains a name/value list of all measurements (from whq), where the name contains  ministry_id : measurement_type_id : dimension. This allows me to lookup a value and see if it has changed.
                    if (rows.Count() > 0)
                    {
                        var everything = gr.GetMeasurements("", ((DateTime)rows.First()["Date"]).ToString("yyyy-MM"), ((DateTime)rows.First()["Date"]).ToString("yyyy-MM"), "", "", false, "&filters[perm_link]=lmi_local_win_%25" +  m_filter).ToList();

                        everything.AddRange(gr.GetMeasurements("", ((DateTime)rows.First()["Date"]).ToString("yyyy-MM"), ((DateTime)rows.First()["Date"]).ToString("yyyy-MM"), "", "", false, "&filters[perm_link]=lmi_local_build_%25" + m_filter).ToList());
                        everything.AddRange(gr.GetMeasurements("", ((DateTime)rows.First()["Date"]).ToString("yyyy-MM"), ((DateTime)rows.First()["Date"]).ToString("yyyy-MM"), "", "", false, "&filters[perm_link]=lmi_local_send_%25" + m_filter).ToList());
                        everything.AddRange(gr.GetMeasurements("", ((DateTime)rows.First()["Date"]).ToString("yyyy-MM"), ((DateTime)rows.First()["Date"]).ToString("yyyy-MM"), "", "", false, "&filters[perm_link]=lmi_local_movements_%25" + m_filter).ToList());
                        everything.AddRange(gr.GetMeasurements("", ((DateTime)rows.First()["Date"]).ToString("yyyy-MM"), ((DateTime)rows.First()["Date"]).ToString("yyyy-MM"), "", "", false, "&filters[perm_link]=lmi_local_nbr_%25" + m_filter).ToList());
                        everything.AddRange(gr.GetMeasurements("", ((DateTime)rows.First()["Date"]).ToString("yyyy-MM"), ((DateTime)rows.First()["Date"]).ToString("yyyy-MM"), "", "", false, "&filters[perm_link]=lmi_local_actual_reporting_nodes" + m_filter).ToList());
                        everything.AddRange(gr.GetMeasurements("", ((DateTime)rows.First()["Date"]).ToString("yyyy-MM"), ((DateTime)rows.First()["Date"]).ToString("yyyy-MM"), "", "", false, "&filters[perm_link]=lmi_local_possible_reporting_nodes" + m_filter).ToList());

                        foreach (MeasurementType row in everything)
                        {
                            foreach (Measurement m in row.measurements)
                            {
                                flat_list.Add(m.RelatedEntityId + ":" + row.ID + ":" + m.Dimension, m.Value);
                                flat_list_mt.Add(m.RelatedEntityId + ":" + row.ID + ":" + m.Dimension, m.ID ) ;
                            }
                        }

                    }
                   //  Console.WriteLine("rows: " + rows.Count().ToString());
                   // Console.WriteLine("flatlist count: " + flat_list.Count);
                    int c_changed = 0;
                    int c_not_changed = 0;

                    Console.Write("processing data:");
                    foreach (DataRow row in rows)
                    {

                        count++;
                        if (delta > 0)
                        {
                            if (count % delta == 1)
                                Console.Write("\rprocessing data for " + ((DateTime)row["Date"]).ToString("yyyy-MM") + ": " + ((int)(100 * count / rows.Count())).ToString() + "% complete.");

                        }

                            string min_id = (from c in d.mid_lookups where c.country == row["Country"].ToString() && c.stage == stage select c.ministry_id).FirstOrDefault();

                            if (string.IsNullOrEmpty(min_id))
                            {
                                var nms_wierd = (from c in d.wierd_countries where c.whq_code == row["Country"].ToString() select c.min_code);
                                Entity nms_ministry = null;

                                if (nms_wierd.Count() > 0 )
                                {
                                    nms_ministry = gr.GetEntities("ministry", "&filters[owned_by]=all&filters[min_code]=" + nms_wierd.First() + "&fields=min_code", 0, 0, ref totalPage).FirstOrDefault();

                                }
                                if (nms_ministry == null)
                                {
                                    nms_ministry = gr.GetEntities("ministry", "&filters[owned_by]=all&filters[iso_country:relationship][iso3_code]=" + row["Country"].ToString() + "&filters[area:relationship][area_code]=" + ids.areas[row["Area"].ToString()] + "&fields=min_code", 0, 0, ref totalPage).FirstOrDefault();

                                }
                                min_id = nms_ministry.ID;
                                App_Code.mid_lookup insert = new App_Code.mid_lookup();
                                insert.ministry_id = min_id;
                                insert.stage = stage;
                                insert.country = row["Country"].ToString();
                                d.mid_lookups.InsertOnSubmit(insert);

                                d.SubmitChanges();
                            }

                            Boolean changed=true;
                            string perm_link = row["LMI"].ToString().ToLower().Replace("fa_", "lmi_local_").Replace("fr_", "lmi_local_").Replace("movements", "lmi_local_movements").Replace("actualreportingnodes", "lmi_local_actual_reporting_nodes").Replace("possiblereportingnodes", "lmi_local_possible_reporting_nodes").Replace("nbr_staff_reporting", "lmi_local_nbr_staff_reporting").Replace("nbr_nonstaff_reporting", "lmi_local_nbr_nonstaff_reporting");
                            if (perm_link.StartsWith("lmi_local"))
                            {

                                MeasurementType this_mt = ids.nms.Where(c => c.PermLink == perm_link).FirstOrDefault();

                                    if (this_mt == null)
                                    {
                                        //get the measurement
                                        // var cache = new WHQtoGR.App_Code.meas_cacheDataContext();

                                        this_mt = gr.GetMeasurements("", "3000-01", "3000-01", "", "", false, "&filters[perm_link]=" + perm_link).FirstOrDefault();
                                        if (this_mt != null)
                                        {
                                            //  Console.WriteLine(perm_link);
                                            ids.nms.Add(this_mt);
                                        }

                                    }
                                    if (this_mt != null)
                                    {
                                        string key = min_id + ":" + this_mt.ID + ":" + ids.mcc_code[row["MCC"].ToString()] + "_gma" ;
                                        if (flat_list.ContainsKey(key ))
                                        {
                                            changed = (flat_list[key] != System.Convert.ToDouble(row["Value"]));
                                            flat_list.Remove(key);
                                            flat_list_mt.Remove(key);  //the remaining items need to be deleted, as they exist in GR but not in WHQ
                                        }

                                        if (changed)
                                        {
                                            this_mt.addMeasurement(min_id, ((DateTime)row["Date"]).ToString("yyyy-MM"), System.Convert.ToDouble(row["Value"]), ids.mcc_code[row["MCC"].ToString()] + "_gma");
                                            c_changed++;
                                        }
                                        else c_not_changed++;
                                        //Console.WriteLine(row["Country"].ToString() + " " + row["MCC"].ToString().ToLower() + " " + perm_link + " : " + System.Convert.ToDouble(row["Value"]));

                                    }
                                    else
                                    {
                                        Console.WriteLine("could not create measurement_type");
                                    }
                            }
                            else
                                Console.WriteLine("could not find " + perm_link);

                    }
                    //Console.WriteLine("changed: " + c_changed);
                    //Console.WriteLine("not_changed: " + c_not_changed);

                    //Console.WriteLine("updloading " + ids.nms.Sum(c => c.measurements.Count()) + " into New Msasurement Model");

                   //TODO: DELETE ALL MEAUREMENTS THAT ARE LEFT IN THE FLATLIST
                    Console.WriteLine("extra (to be delete): " + flat_list_mt.Count());
                   foreach(var m in flat_list_mt)
                   {
                       gr.DeleteMeasuerment(m.Value);
                      //need to get measurement_id into flatlist key
                   }

                    da.Dispose();
                    dt.Dispose();
                }
                //dt.Dump();
            }

            Console.WriteLine("Finished generating measurmenets");

            Console.WriteLine("updloading " + ids.nms.Sum(c => c.measurements.Count()) + " into New Msasurement Model");
            var tasks = new List<Task>();
            foreach (MeasurementType mt in ids.nms)
            {

                tasks.Add(System.Threading.Tasks.Task.Factory.StartNew(() =>
                {

                    gr.AddUpdateMeasurement(mt, true, 100);
                }));

            }

            System.Threading.Tasks.Task.WaitAll(tasks.ToArray<Task>());

            Console.WriteLine("Finished ");
            // Console.ReadKey();
        }