Ejemplo n.º 1
0
        private void Restore()
        {
            btnAdd.Enabled  = true;
            btnEdit.Enabled = btnDelete.Enabled = btnSave.Enabled = btnCancel.Enabled
                                                                        = btnDelDetail.Enabled = btnAddDetail.Enabled = cbSupplier.Enabled = txtMemo.Enabled = false;
            //cbSupplier.SelectedIndex = 0;
            lbxSerialnumber.DataSource = null;
            purchase                = null;
            purchaseDetails         = null;
            selected_PurchaseDetail = null;

            //清理所有文本框
            foreach (var c in groupBox2.Controls)
            {
                if (c is TextBox)
                {
                    ((TextBox)c).Text = string.Empty;
                }
            }

            dgvDetails.DataSource = null;
            _op                     = EnumOperation.None;
            purchase                = new Purchase();
            purchaseDetails         = new List <PurchaseDetail>();
            selected_PurchaseDetail = new PurchaseDetail();
        }
Ejemplo n.º 2
0
        public async Task <HttpResponseMessage> Execute(Func <Task> action, EnumOperation enumOperation, RouteData routeData, int userId)
        {
            try
            {
                if (enumOperation == EnumOperation.Get)
                {
                    await action();
                }

                else
                {
                    if (action != null)
                    {
                        await action();
                    }
                    await unitOfWork.IRepoLogOperation.Add(GetLogOperation(enumOperation, routeData, userId));

                    await unitOfWork.Commit();
                }
                return(new HttpResponseMessage(System.Net.HttpStatusCode.OK));
            }
            catch (Exception exception)
            {
                await unitOfWork.Rollback();

                await unitOfWork.IRepoLogException.Add(GetLogException(exception, userId));

                await unitOfWork.Commit();

                throw;
            }
        }
Ejemplo n.º 3
0
 private void btnCancel_Click(object sender, EventArgs e)
 {
     op             = EnumOperation.None;
     btnAdd.Enabled = btnEdit.Enabled = btnDel.Enabled = true;
     gbInfo.Visible = false;
     gbInfo.Text    = "操作";
 }
Ejemplo n.º 4
0
 private void btnDel_Click(object sender, EventArgs e)
 {
     op             = EnumOperation.Delete;
     btnAdd.Enabled = btnEdit.Enabled = btnDel.Enabled = false; //增改删按钮禁用,不能重复点两只
     gbInfo.Visible = true;                                     //下方区域显示
     gbInfo.Text    = "删除数据";
 }
Ejemplo n.º 5
0
        protected LogOperation GetLogException(EnumOperation operation)
        {
            LogOperation logOperation = new LogOperation()
            {
                Date        = DateTime.Now,
                Controller  = this.ControllerContext.RouteData.Values["controller"].ToString(),
                Description = this.ControllerContext.RouteData.Values["action"].ToString(),
                Operation   = operation.ToString()
            };

            return(logOperation);
        }
Ejemplo n.º 6
0
 private void lbxSerialnumber_Click(object sender, EventArgs e)
 {
     try
     {
         if (!string.IsNullOrEmpty(lbxSerialnumber.SelectedItem.ToString()))
         {
             btnAdd.Enabled  = false;
             btnEdit.Enabled = btnDelete.Enabled = btnSave.Enabled = btnCancel.Enabled = btnDelDetail.Enabled = btnAddDetail.Enabled = cbSupplier.Enabled = txtMemo.Enabled = true;
             _op             = EnumOperation.Update;
         }
     }
     catch { }
 }
Ejemplo n.º 7
0
        /// <summary>
        /// 极光推送(ios和安卓)
        /// </summary>
        /// <param name="push">系统消息推送</param>
        /// <param name="platform"></param>
        public static void Jpush(SystemPushMongo push, Constants.DataType.Platform platform)
        {
            var customerId = push.CustomerId;
            var title      = push.Title;
            var content    = push.Content;
            var client     = new JPushClient(Constants.Jpush.AppKey, Constants.Jpush.MasterSecret);

            var list = CusJpServer.GetListByCusId(customerId);

            // android -->01  iod -->02
            var pushList = list.Where(en => en.Platform.Equals(EnumOperation.Description(platform))).ToArray();


            if (!pushList.Any())
            {
                return;
            }

            if (platform == Constants.DataType.Platform.Android)
            {
                var androidHashSet = new HashSet <string>();
                foreach (var customerJPush in pushList)
                {
                    androidHashSet.Add(customerJPush.RegId);
                }
                var payload = new PushPayload(Platform.android(), Audience.s_registrationId(androidHashSet),
                                              Notification.android(title, content));

                client.SendPush(payload);
            }
            else
            {
                var iosHashSet = new HashSet <string>();
                foreach (var customerJPush in pushList)
                {
                    iosHashSet.Add(customerJPush.RegId);
                }

#if DEBUG
                var payload = new PushPayload(Platform.ios(), Audience.s_registrationId(iosHashSet), Notification.ios(content), null, new Options());
#endif
#if !DEBUG
                PushPayload payload = new PushPayload(Platform.ios(), Audience.s_registrationId(iosHashSet), Notification.ios(content));
#endif
                client.SendPush(payload);
            }
        }
Ejemplo n.º 8
0
        protected LogOperation GetLogOperation(EnumOperation operation, RouteData routeData, int userId)
        {
            LogOperation logOperation = new LogOperation()
            {
                Date        = DateTime.Now,
                Controller  = routeData.Values["controller"].ToString(),
                Description = routeData.Values["action"].ToString(),
                Operation   = operation.ToString(),
                UserId      = userId
            };

            if (userId == 0)
            {
                logOperation.Description += " Login: "******"Login"].ToString();
            }
            return(logOperation);
        }
Ejemplo n.º 9
0
        void BeginHarvest(int placeid)
        {
            this.currentOperation = EnumOperation.PreHarvest;
            string url = string.Format(
                "http://my.hf.fminutes.com/api.php?mod=farmlandstatus&act=harvest&farmKey={0}&farmTime={1}&inuId=",
                FarmKey,
                UnixStamp()
                );
            StringBuilder sbHtml = new StringBuilder();
            sbHtml.Append(string.Format("<form action=\"{0}\" method=\"post\">", url));
            sbHtml.Append(string.Format("<input id=\"ownerId\" name=\"ownerId\" value=\"{0}\" type=\"text\" />", cs.user.uId));
            sbHtml.Append(string.Format("<input id=\"place\" name=\"place\" value=\"{0}\" type=\"text\" />", placeid));
            sbHtml.Append("<input id=\"sub\" name=\"sub\" type=\"submit\" />");
            sbHtml.Append("</form>");
            this.wbMain.DocumentText = sbHtml.ToString();

            ShowMessage("准备收获第" + placeid + "块...");
        }
Ejemplo n.º 10
0
        public void SomeOperation(EnumOperation operation)
        {
            Manage manage = new Manage();

            switch (operation)
            {
            case EnumOperation.Add:
                manage.Add();
                break;

            case EnumOperation.Delete:
                manage.Delete();
                break;

            case EnumOperation.Edit:
                manage.Edit();
                break;
            }
        }
Ejemplo n.º 11
0
        public MainForm()
        {
            InitializeComponent();
            cookie = new CookieContainer();

            httper = new NewHttper();
            httper.Cookie = cookie;
            httper.Charset = "UTF-8";
            httper.RequestDataCompleted += new NewHttper.RequestDataCompletedEventHandler(httper_RequestDataCompleted);
            httper.RequestStringCompleted += new NewHttper.RequestStringCompleteEventHandler(httper_RequestStringCompleted);

            this.timer = new Timer();
            this.timer.Interval = 20000;
            this.timer.Tick += new EventHandler(timer_Tick);
            this.timer.Stop();

            sf = new StatusForm();
            harvestList = new List<int>();
            this.currentOperation = EnumOperation.None;
        }
Ejemplo n.º 12
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            //用户必须选定一条流水
            if (purchase == null)
            {
                MessageBox.Show("请先选择要编辑的一条入库申请!");
                return;
            }

            //入库申请的状态为正在申0,才能编辑
            if (purchase.OnProcess != 0)
            {
                MessageBox.Show("此申请为已审核、已完成或已撤销状态时不能编辑!");
                return;
            }

            _op                  = EnumOperation.Delete;
            btnSave.Enabled      = btnCancel.Enabled = btnEdit.Enabled = true;
            btnDelDetail.Enabled = btnAddDetail.Enabled = cbSupplier.Enabled = txtMemo.Enabled = btnAdd.Enabled = false;
        }
Ejemplo n.º 13
0
        /// <summary>
        /// MVC前端传值更新模型
        /// </summary>
        /// <param name="id">更新时的主键值</param>
        /// <param name="tableName">表名</param>
        /// <param name="collection">form表单</param>
        /// <param name="operation">更新类型</param>
        /// <returns>更新的记录数</returns>
        public int UpdateModel(int?id, string tableName, NameValueCollection collection, EnumOperation operation)
        {
            int       error  = 0;
            DataTable Column = _db.GetMap(tableName.ToString());
            string    sqlStr = operation + " [" + tableName + "] ";

            if (operation == EnumOperation.Insert)
            {
                string conStrColumn = "(";
                string conStrValue  = " values (";
                foreach (DataColumn item in Column.Columns)
                {
                    string columnName = item.ColumnName;
                    if (collection[columnName] != null && columnName != "ID")
                    {
                        string itemValue = collection[columnName].Replace("'", "").Trim();
                        conStrColumn = conStrColumn + "[" + columnName + "] ,";
                        if (item.DataType == typeof(String) || item.DataType == typeof(DateTime) || item.DataType == typeof(TimeSpan))
                        {
                            if (string.IsNullOrEmpty(itemValue))
                            {
                                conStrValue += " null" + ",";
                            }
                            else
                            {
                                conStrValue += " '" + itemValue + "'" + " ,";
                            }
                        }
                        else if (item.DataType == typeof(Boolean))
                        {
                            if (string.IsNullOrEmpty(itemValue))
                            {
                                conStrValue += "null,";
                            }
                            else
                            {
                                if (itemValue == "True")
                                {
                                    conStrValue += " 1 ,";
                                }
                                else
                                {
                                    conStrValue += " 0 ,";
                                }
                            }
                        }
                        else
                        {
                            if (string.IsNullOrEmpty(itemValue))
                            {
                                conStrValue += "null,";
                            }
                            else
                            {
                                conStrValue += " " + itemValue + " ,";
                            }
                        }
                    }
                }
                conStrColumn  = conStrColumn.Substring(0, conStrColumn.Length - 1);
                conStrValue   = conStrValue.Substring(0, conStrValue.Length - 1);
                conStrColumn += ")";
                conStrValue  += ")";
                sqlStr        = sqlStr + conStrColumn + conStrValue;
            }
            else if (operation == EnumOperation.Update)
            {
                if (id != null)
                {
                    string conStrColumn = "";
                    string conStrValue  = "";
                    string ConStr       = " set ";
                    foreach (DataColumn item in Column.Columns)
                    {
                        string columnName = item.ColumnName;
                        if (collection[columnName] != null && columnName != "ID")
                        {
                            string itemValue = collection[columnName].Replace("'", "").Trim();
                            if (string.IsNullOrEmpty(itemValue))
                            {
                                itemValue = "null";
                            }
                            conStrColumn = " [" + columnName + "]";
                            if (item.DataType == typeof(String) || item.DataType == typeof(DateTime) || item.DataType == typeof(TimeSpan))
                            {
                                if (string.IsNullOrEmpty(itemValue))
                                {
                                    conStrValue = " null ";
                                }
                                else
                                {
                                    conStrValue = " '" + itemValue + "' ";
                                }
                            }
                            else if (item.DataType == typeof(Boolean))
                            {
                                if (string.IsNullOrEmpty(itemValue))
                                {
                                    conStrValue = " null ";
                                }
                                else
                                {
                                    if (itemValue == "True")
                                    {
                                        conStrValue = " 1 ";
                                    }
                                    else
                                    {
                                        conStrValue = " 0 ";
                                    }
                                }
                            }
                            else
                            {
                                if (string.IsNullOrEmpty(itemValue))
                                {
                                    conStrValue = " null ";
                                }
                                else
                                {
                                    conStrValue = " " + itemValue + " ";
                                }
                            }
                            ConStr += conStrColumn + "=" + conStrValue + " ,";
                        }
                    }
                    ConStr = ConStr.Substring(0, ConStr.Length - 1);
                    string PKColumnName = "ID";
                    sqlStr += ConStr + " where [" + PKColumnName + "]=" + id;
                }
                else
                {
                    error = -1;
                }
            }
            if (error == -1)
            {
                return(error);
            }
            else
            {
                return(ExecuteNonQuery(sqlStr));
            }
        }
Ejemplo n.º 14
0
 /// <summary>
 /// Получение параметров из атрибутов блока
 /// </summary>      
 private void getAttrs(BlockReference blRef)
 {
     foreach (ObjectId idAtr in blRef.AttributeCollection )
      {
     using (var atr = idAtr.GetObject(OpenMode.ForRead) as AttributeReference)
     {
        string tag = atr.Tag.ToUpper();
        // Принадлежность
        if (tag.Equals(Options.Instance.SupplementBlAttrTagOwner.ToUpper()))
        {
           _owner = RoomService.GetConstructionType (atr.TextString);
        }
        // Материал
        if (tag.Equals(Options.Instance.SupplementBlAttrTagMaterial.ToUpper()))
        {
           _material = atr.TextString.ClearString();
        }
        // Действие
        if (tag.Equals(Options.Instance.SupplementBlAttrTagOperation.ToUpper()))
        {
           _operation = getOperationType(atr.TextString);
        }
     }
      }
 }
Ejemplo n.º 15
0
 public PermisionValidate(EnumOperation operation, EnumPermission permission)
 {
     Operation  = operation;
     Permission = permission;
 }
Ejemplo n.º 16
0
 void BeginRefeshCurrentStatus()
 {
     this.currentOperation = EnumOperation.CheckFarmStatus;
     ShowMessage("开始刷新数据...");
     string url = string.Format(
         "http://my.hf.fminutes.com/api.php?mod=user&act=run&farmKey={0}&farmTime={1}&inuId=",
         FarmKey,
         UnixStamp()
         );
     wbMain.Navigate(url);
     textBox2.Text += "正在获取状态数据..." + Environment.NewLine;
 }
Ejemplo n.º 17
0
 void Harvest2()
 {
     this.currentOperation = EnumOperation.Harvest;
     HtmlElement htmlbtnSub = this.wbMain.Document.Body.All["sub"];
     htmlbtnSub.InvokeMember("click");
     ShowMessage("正在收获...");
 }
Ejemplo n.º 18
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     _op             = EnumOperation.Insert;
     btnSave.Enabled = btnCancel.Enabled = btnDelDetail.Enabled = btnAddDetail.Enabled = cbSupplier.Enabled = txtMemo.Enabled = true;
     btnEdit.Enabled = btnDelete.Enabled = false;
 }
Ejemplo n.º 19
0
        void HarvestCompleted()
        {
            this.currentOperation = EnumOperation.None;
            HarvestInfo hi = null;
            try
            {
                hi = (HarvestInfo)JavaScriptConvert.DeserializeObject(this.wbMain.DocumentText, typeof(HarvestInfo));
            }
            catch (Exception ex)
            {
                ShowMessage(ex.Message);
            }
            if (hi != null)
            {
                ShowMessage("[farmlandIndex]" + hi.farmlandIndex + ":[code]" + hi.code + ":[poptype]" + hi.poptype + ":[direction]" + hi.direction + ":[harvest]" + hi.harvest);
                ShowMessage("完毕!");
            }
            else
            {
                ShowMessage("意外完毕!" + this.wbMain.DocumentText);
            }
            this.harvestList.RemoveAt(0);

            if (this.harvestList.Count > 0)
            {
                BeginHarvest(this.harvestList[0]);
            }
            else
            {
                ShowMessage("所有完毕!");
            }
        }
Ejemplo n.º 20
0
 void InitAppCompleted()
 {
     this.currentOperation = EnumOperation.None;
     ShowMessage("引导应用完成!");
     BeginRefeshCurrentStatus();
 }
Ejemplo n.º 21
0
 //         ---------------------------------------------------------------------
 //        Methods for Attribute Operation
 //        ---------------------------------------------------------------------
 ///
 ///          <summary> * (5) set attribute Operation </summary>
 ///          * <param name="enumVar">: the enumVar to set the attribute to </param>
 ///
 public virtual void setOperation(EnumOperation enumVar)
 {
     setAttribute(AttributeName.OPERATION, enumVar == null ? null : enumVar.getName(), null);
 }
Ejemplo n.º 22
0
 void BeginInitApp()
 {
     this.currentOperation = EnumOperation.InitApp;
     ShowMessage("开始引导应用...");
     wbMain.Navigate("http://u.discuz.net/home/userapp.php?id=1021978");
 }
Ejemplo n.º 23
0
 public BaseInfoForm()
 {
     InitializeComponent();
     op = EnumOperation.None;  //缺省为none,啥也没做
 }
Ejemplo n.º 24
0
 ///
 ///          <summary> * (9) get attribute Operation </summary>
 ///          * <returns> the value of the attribute </returns>
 ///
 public virtual EnumOperation getOperation()
 {
     return(EnumOperation.getEnum(getAttribute(AttributeName.OPERATION, null, null)));
 }
Ejemplo n.º 25
0
        private void RefeshCurrentStatusCompleted()
        {
            this.currentOperation = EnumOperation.None;
            ShowMessage("刷新数据完成!");
            cs = GetCurrentStatus(this.wbMain.DocumentText);
            UpdateStatusForm();

            ShowMessage("开始检查收获...");
            for (int i = 0; i < this.cs.farmlandStatus.Length; i++)
            {
                if (cs.farmlandStatus[i].b == 6)
                {
                    this.harvestList.Add(i);
                }
            }
            if (this.harvestList.Count > 0)
            {
                ShowMessage(this.harvestList.Count + "块等待收获!");
                BeginHarvest(this.harvestList[0]);
            }
            else
            {
                ShowMessage("没有需要收获!");
            }
        }
Ejemplo n.º 26
0
 static JDFAutoColorSpaceConversionOp()
 {
     atrInfoTable[0]  = new AtrInfoTable(AttributeName.IGNOREEMBEDDEDICC, 0x33333333, AttributeInfo.EnumAttributeType.boolean_, null, "false");
     atrInfoTable[1]  = new AtrInfoTable(AttributeName.PRESERVEBLACK, 0x33333331, AttributeInfo.EnumAttributeType.boolean_, null, "false");
     atrInfoTable[2]  = new AtrInfoTable(AttributeName.RENDERINGINTENT, 0x33333333, AttributeInfo.EnumAttributeType.enumeration, EnumRenderingIntent.getEnum(0), "ColorSpaceDependent");
     atrInfoTable[3]  = new AtrInfoTable(AttributeName.RGBGRAY2BLACK, 0x33333333, AttributeInfo.EnumAttributeType.boolean_, null, "false");
     atrInfoTable[4]  = new AtrInfoTable(AttributeName.RGBGRAY2BLACKTHRESHOLD, 0x33333311, AttributeInfo.EnumAttributeType.double_, null, "1");
     atrInfoTable[5]  = new AtrInfoTable(AttributeName.SOURCEOBJECTS, 0x33333333, AttributeInfo.EnumAttributeType.enumerations, EnumSourceObjects.getEnum(0), "All");
     atrInfoTable[6]  = new AtrInfoTable(AttributeName.OPERATION, 0x33333333, AttributeInfo.EnumAttributeType.enumeration, EnumOperation.getEnum(0), null);
     atrInfoTable[7]  = new AtrInfoTable(AttributeName.SOURCECS, 0x33333333, AttributeInfo.EnumAttributeType.enumeration, EnumSourceCS.getEnum(0), null);
     atrInfoTable[8]  = new AtrInfoTable(AttributeName.SOURCERENDERINGINTENT, 0x33333311, AttributeInfo.EnumAttributeType.enumeration, EnumSourceRenderingIntent.getEnum(0), null);
     elemInfoTable[0] = new ElemInfoTable(ElementName.DEVICENSPACE, 0x66666611);
     elemInfoTable[1] = new ElemInfoTable(ElementName.FILESPEC, 0x66666666);
     elemInfoTable[2] = new ElemInfoTable(ElementName.SEPARATIONSPEC, 0x33333311);
 }
Ejemplo n.º 27
0
 public Operation(string u, int oprnd, EnumOperation oprtr)
 {
     uid       = u;
     operand   = oprnd;
     operation = oprtr;
 }