Exemplo n.º 1
0
        public void DoDelete()
        {
            if (this.grdQuery.ActiveRow == null) return;

            DialogResult result = baseForm.CreateMessageBox(Public_MessageBox.Question,
                        MessageBoxButtons.OKCancel,
                        UtilCulture.GetString("Msg.R00004"),
                        "<span style='font-weight:bold;'>" + UtilCulture.GetString("Label.R01023") + ": </span> " +
                            this.grdQuery.ActiveRow.Cells["yearmonth"].Value.ToString() + "," +
                            this.grdQuery.ActiveRow.Cells["customerid"].Value.ToString() + "," +
                            this.grdQuery.ActiveRow.Cells["factory"].Value.ToString());

            if (result == DialogResult.Cancel) return;

            wsINP.IwsINPClient client = new wsINP.IwsINPClient();
            try
            {
                baseForm.SetCursor();

                List<MESParameterInfo> lstParameters = new List<MESParameterInfo>() {
                    new MESParameterInfo(){
                        ParamName="yearmonth",
                        ParamValue=this.grdQuery.ActiveRow.Cells["yearmonth"].Value.ToString(),
                        ParamType="string"
                    },
                    new MESParameterInfo(){
                        ParamName="customerid",
                        ParamValue=this.grdQuery.ActiveRow.Cells["customerid"].Value.ToString(),
                        ParamType="string"
                    },
                    new MESParameterInfo(){
                        ParamName="factory",
                        ParamValue=this.grdQuery.ActiveRow.Cells["factory"].Value.ToString(),
                        ParamType="string"
                    }
                };

                client.DoDeleteSchedule(baseForm.CurrentContextInfo, lstParameters.ToArray<MESParameterInfo>());

                MESMsgBox.ShowInformation(UtilCulture.GetString("Msg.R00003"));

                GetData(QueryParameters);
            }
            catch (Exception ex)
            {
                MESMsgBox.ShowError(ExceptionParser.Parse(ex));
            }
            finally
            {
                baseForm.ResetCursor();
                baseForm.CloseWCF(client);
            }
        }