Beispiel #1
0
        //行事件
        protected void Grid1_RowCommand(object sender, FineUI.GridCommandEventArgs e)
        {
            if (e.CommandName == "Delete")
            {
                int id   = Convert.ToInt32(Grid1.Rows[e.RowIndex].Values[0]);
                int flag = operate.DeletePublishByID(id);
                if (flag >= 1)
                {
                    Alert.ShowInParent("删除成功");
                    BindData();
                }
                else
                {
                    Alert.ShowInParent("删除失败");
                }
            }
            else if (e.CommandName == "CheckBox1")
            {
                int id = Convert.ToInt32(Grid1.Rows[e.RowIndex].Values[0]);
                FineUI.CheckBoxField checkField = (FineUI.CheckBoxField)Grid1.FindColumn(e.ColumnIndex);
                bool checkState = checkField.GetCheckedState(e.RowIndex);

                int a = operate.UpdatePublishByID(id, checkState);
                if (a > 0)
                {
                    Alert.ShowInParent("操作成功");
                    BindData();
                }
                else
                {
                    Alert.ShowInParent("操作失败");
                }
            }
        }
Beispiel #2
0
        //验证是否同一物料编码
        private bool isOneItem()
        {
            //int[] selections = Grid2.SelectedRowIndexArray;
            FineUI.CheckBoxField canReadField = Grid2.FindColumn("CanRead") as FineUI.CheckBoxField;
            string itemNo = "";
            int    find   = 0;

            for (int i = 0; i < Grid2.Rows.Count; i++)
            {
                bool canRead = canReadField.GetCheckedState(i);
                if (canRead)
                {
                    find += 1;
                    string curItemNo = Grid2.Rows[i].Values[2].ToString();
                    if (find == 1)
                    {
                        itemNo = curItemNo;
                    }
                    else
                    {
                        if (itemNo != curItemNo)
                        {
                            find = -1;
                            break;
                        }
                    }
                }
            }
            //for (int i = 1; i < selections.Length; i++)
            //{
            //    string compLineName = Grid2.Rows[selections[i]].Values[2].ToString();
            //    if (lineName != compLineName)
            //    {
            //        find = i;
            //    }
            //}

            if (find == -1)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
        // 行事件
        protected void Grid1_RowCommand(object sender, FineUI.GridCommandEventArgs e)
        {
            if (e.CommandName == "Delete")
            {
                string keyname = Grid1.Rows[e.RowIndex].Values[1].ToString();
                int    flag    = operate.DeleteRecommendByTypeName(keyname);
                if (flag >= 1)
                {
                    Alert.ShowInParent("删除成功");
                    BindData();
                }
                else
                {
                    Alert.ShowInParent("删除失败");
                }
            }
            else if (e.CommandName == "CheckBox1")
            {
                string keyname = Grid1.Rows[e.RowIndex].Values[1].ToString();
                FineUI.CheckBoxField checkField = (FineUI.CheckBoxField)Grid1.FindColumn(e.ColumnIndex);
                bool checkState = checkField.GetCheckedState(e.RowIndex);

                int a = operate.UpdateRecommendByTypeName(keyname, checkState);
                if (a > 0)
                {
                    Alert.ShowInParent("操作成功");
                    BindData();
                }
                else
                {
                    Alert.ShowInParent("操作失败");
                }
            }
            else if (e.CommandName == "MoveUp")
            {
                int ID = Convert.ToInt32(Grid1.Rows[e.RowIndex].Values[0].ToString());
                operate.GetRecommendByMove(ID, "上移");
                BindData();
            }
            else if (e.CommandName == "MoveDown")
            {
                int ID = Convert.ToInt32(Grid1.Rows[e.RowIndex].Values[0].ToString());
                operate.GetRecommendByMove(ID, "下移");
                BindData();
            }
        }
Beispiel #4
0
        protected void btnGroupUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                int roleId = GetSelectedRoleId();
                // 添加所有记录
                FineUI.CheckBoxField canReadField = Grid2.FindColumn("CanRead") as FineUI.CheckBoxField;
                int MenuId = 0;
                foreach (GridRow row in Grid2.Rows)
                {
                    int rowIndex = row.RowIndex;

                    object[] dataKeys = Grid2.DataKeys[rowIndex];
                    // 当前行对应的模块名称
                    MenuId = Convert.ToInt32(dataKeys[0]);
                    bool   canRead = canReadField.GetCheckedState(rowIndex);
                    string sqlCmd  = "";
                    if (canRead)
                    {
                        sqlCmd  = "insert into OA_Sys_RoleMenu (roleId,menuId) values (";
                        sqlCmd += "'" + roleId + "','" + MenuId + "')";
                        SqlSel.ExeSql(sqlCmd);
                    }
                    if (!canRead)
                    {
                        sqlCmd = "delete from OA_Sys_RoleMenu where roleId='" + roleId + "' and menuId='" + MenuId + "'";
                        SqlSel.ExeSql(sqlCmd);
                    }

                    Alert.ShowInTop("角色权限更新成功!");
                }
            }
            catch (Exception ex)
            {
                Alert.ShowInTop(ex.Message);
            }
        }
Beispiel #5
0
        protected void btn_Add_Click(object sender, EventArgs e)
        {
            try
            {
                FineUI.CheckBoxField canReadField = Grid2.FindColumn("CanRead") as FineUI.CheckBoxField;
                Label1.Text = "";
                if (isOneItem())
                {
                    int           sumCount   = 0;
                    StringBuilder sb_orderNo = new StringBuilder();
                    StringBuilder sb_msg     = new StringBuilder();//超产订单信息

                    DataTable dt = new DataTable();
                    dt.Columns.Add("orderId");
                    dt.Columns.Add("orderCount");
                    int firstRowIndex = -1;
                    int find          = 0;
                    for (int i = 0; i < Grid2.Rows.Count; i++)
                    {
                        bool canRead = canReadField.GetCheckedState(i);
                        if (canRead)
                        {
                            find += 1;
                            if (find == 1)
                            {
                                firstRowIndex = i;
                            }
                            //循环插入至隐藏业务订单列表
                            DataRow newRow = dt.NewRow();
                            GridRow grow   = Grid2.Rows[i];
                            newRow["orderId"]    = grow.DataKeys[0].ToString();
                            newRow["orderCount"] = grow.Values[8].ToString();
                            dt.Rows.Add(newRow);
                            //拼接订单号
                            sb_orderNo.AppendFormat("{0}/", Grid2.Rows[i].Values[1].ToString());
                            sumCount += Convert.ToInt32(Grid2.Rows[i].Values[8]);
                            //超产订单提示
                            if (Convert.ToInt32(Grid2.Rows[i].Values[6]) <= Convert.ToInt32(Grid2.Rows[i].Values[7]))
                            {
                                sb_msg.AppendFormat("订单号:{0} 排产数量已达到计划数量,请确认是否继续排产;\r\n", Grid2.Rows[i].Values[1].ToString());
                            }
                        }
                    }
                    Label1.Text            = sb_msg.ToString();
                    Grid_hidden.DataSource = dt;
                    Grid_hidden.DataBind();
                    if (firstRowIndex >= 0)
                    {
                        txb_itemNo.Text = Grid2.Rows[firstRowIndex].Values[2].ToString().Trim();                              //物料编码
                        string childrenItemInfo = getChildrenItemInfo(Grid2.Rows[firstRowIndex].Values[2].ToString().Trim());
                        txb_itemName.Text   = Grid2.Rows[firstRowIndex].Values[5].ToString().Trim();                          //品名
                        TextArea_parm.Text  = Grid2.Rows[firstRowIndex].Values[4].ToString().Trim() + "/" + childrenItemInfo; //规格
                        txb_workNo.Text     = sb_orderNo.ToString().Substring(0, sb_orderNo.ToString().Length - 1);           //合并订单,删除最后一个‘/’标记
                        numb_planCount.Text = sumCount.ToString();                                                            //合并排产数量
                        txb_itemTech.Text   = Grid2.Rows[firstRowIndex].Values[9].ToString().Trim();                          //工艺要求
                    }
                    else
                    {
                        Alert.ShowInTop("未选中任何数据!");
                        return;
                    }
                }
                else
                {
                    Alert.ShowInTop("不同物料编码不可合并排产!");
                    return;
                }
            }
            catch (Exception ex)
            {
                Alert.ShowInTop(ex.Message);
                return;
            }
        }