示例#1
0
        public void SetUp()
        {
            products = new List<Product>();
              companies = new List<Company>();
              acquisitions = new List<Acquisition>();
              acquisitionItems = new List<AcquisitionItem>();
              sales = new List<Sale>();
              saleItems = new List<SaleItem>();
              stocks = new List<Stock>();

              repository = new Mock<Repository>();
              repository.SetUpTable(it => it.Products, products);
              repository.SetUpTable(it => it.Companies, companies);
              repository.SetUpTable(it => it.Acquisitions, acquisitions);
              repository.SetUpTable(it => it.AcquisitionItems, acquisitionItems);
              repository.SetUpTable(it => it.Sales, sales);
              repository.SetUpTable(it => it.SaleItems, saleItems);
              repository.SetUpTable(it => it.Stocks, stocks);

              repository
            .Setup(it => it.SaveChanges())
            .Callback(() =>
            {
              acquisitions.ForEach(FixItems);
              sales.ForEach(FixItems);
            });
              transaction = new Mock<TransactionBlock>();
              repository
            .Setup(it => it.CreateTransaction(It.IsAny<IsolationLevel>()))
            .Returns(transaction.Object);

              sut = new BusinessLogic(() => repository.Object);
        }
示例#2
0
 public static StylesheetProperty MakeNew(string Text, StyleSheet sheet, BusinessLogic.User user) {
     CMSNode newNode = CMSNode.MakeNew(sheet.Id, moduleObjectType, user.Id, 2, Text, Guid.NewGuid());
     SqlHelper.ExecuteNonQuery(String.Format("Insert into cmsStylesheetProperty (nodeId,stylesheetPropertyAlias,stylesheetPropertyValue) values ('{0}','{1}','')", newNode.Id, Text));
     StylesheetProperty ssp = new StylesheetProperty(newNode.Id);
     NewEventArgs e = new NewEventArgs();
     ssp.OnNew(e);
     return ssp;
 }
示例#3
0
        public PromoModel(BusinessLogic.AccountBase accountBase, Guid? promoId)
        {
            // TODO: Complete member initialization
            this.AccountBase = accountBase;
            this.PromoId = promoId;

            Setup();
        }
示例#4
0
        public PromoIndexModel(BusinessLogic.AccountBase accountBase, Guid? businessId, string businessName)
        {
            // TODO: Complete member initialization
            this.AccountBase = accountBase;
            this.BusinessId = businessId;
            this.BusinessName = businessName;

            Setup();
        }
示例#5
0
		public static void UpdateCruds(BusinessLogic.User User, Cms.BusinessLogic.CMSNode Node, string Permissions) 
		{
			// delete all settings on the node for this user
			Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(GlobalSettings.DbDSN, CommandType.Text, "delete from umbracoUser2NodePermission where userId = @userId and nodeId = @nodeId", new SqlParameter("@userId", User.Id), new SqlParameter("@nodeId", Node.Id)); 

			// Loop through the permissions and create them
			foreach (char c in Permissions.ToCharArray())
				MakeNew(User, Node, c);
		}
示例#6
0
 public Trigger(BusinessLogic.AutoMerge.Base.ISelect selectAutoMergeBLL,
                 BusinessLogic.Notifications.Base.ISend notificationsSendBLL,
                 BusinessLogic.Core.Base.ISettings settingsBLL,
                 BusinessLogic.AutoMergeLog.Base.IInsert insertLogBLL)
 {
     this.selectAutoMergeBLL = selectAutoMergeBLL;
     this.notificationsSendBLL = notificationsSendBLL;
     this.settingsBLL = settingsBLL;
     this.insertLogBLL = insertLogBLL;
 }
 public AutoMergeController(BusinessLogic.AutoMerge.Base.IInsert insertBLL,
                             BusinessLogic.AutoMerge.Base.ITrigger triggerBLL,
                             BusinessLogic.AutoMerge.Base.IUpdate updateBLL,
                             BusinessLogic.AutoMerge.Base.ISelect selectBLL)
 {
     this.insertBLL = insertBLL;
     this.triggerBLL = triggerBLL;
     this.updateBLL = updateBLL;
     this.selectBLL = selectBLL;
 }
示例#8
0
		public static StyleSheet MakeNew(BusinessLogic.User user, string Text, string FileName, string Content) 
		{
			
			// Create the Umbraco node
			CMSNode newNode = CMSNode.MakeNew(-1, moduleObjectType, user.Id, 1, Text, Guid.NewGuid());

			// Create the stylesheet data
			Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(_ConnString, CommandType.Text, "insert into cmsStylesheet (nodeId, filename, content) values ('" + newNode.Id.ToString() + "','" + FileName + "',@content)", new SqlParameter("@content", Content));
			
			return new StyleSheet(newNode.UniqueId);
		}
        public override void DoHandleMedia(Media media, PostedMediaFile postedFile, BusinessLogic.User user)
        {
            // Get Image object, width and height
            var image = System.Drawing.Image.FromStream(postedFile.InputStream);
            var fileWidth = image.Width;
            var fileHeight = image.Height;

            // Get umbracoFile property
            var propertyId = media.getProperty("umbracoFile").Id;

            // Get paths
            var destFileName = ConstructDestFileName(propertyId, postedFile.FileName);
            var destPath = ConstructDestPath(propertyId);
            var destFilePath = VirtualPathUtility.Combine(destPath, destFileName);
            var ext = VirtualPathUtility.GetExtension(destFileName).Substring(1);

            var absoluteDestPath = HttpContext.Current.Server.MapPath(destPath);
            var absoluteDestFilePath = HttpContext.Current.Server.MapPath(destFilePath);

            // Set media properties
            media.getProperty("umbracoFile").Value = destFilePath;
            media.getProperty("umbracoWidth").Value = fileWidth;
            media.getProperty("umbracoHeight").Value = fileHeight;
            media.getProperty("umbracoBytes").Value = postedFile.ContentLength;

            if (media.getProperty("umbracoExtension") != null)
                media.getProperty("umbracoExtension").Value = ext;

            if (media.getProperty("umbracoExtensio") != null)
                media.getProperty("umbracoExtensio").Value = ext;

            // Create directory
            if (UmbracoSettings.UploadAllowDirectories)
                Directory.CreateDirectory(absoluteDestPath);

            // Generate thumbnail
            var thumbDestFilePath = Path.Combine(absoluteDestPath, Path.GetFileNameWithoutExtension(destFileName) + "_thumb");
            GenerateThumbnail(image, 100, fileWidth, fileHeight, thumbDestFilePath + ".jpg");

            // Generate additional thumbnails based on PreValues set in DataTypeDefinition uploadField
            GenerateAdditionalThumbnails(image, fileWidth, fileHeight, thumbDestFilePath);

            image.Dispose();

            // Save file
            postedFile.SaveAs(absoluteDestFilePath);

            // Close stream
            postedFile.InputStream.Close();

            // Save media
            media.Save();
        }
示例#10
0
		/// <summary>
		/// Create a new MemberType
		/// </summary>
		/// <param Name="Text">The Name of the MemberType</param>
		/// <param Name="u">Creator of the MemberType</param>
		public static MemberType MakeNew( BusinessLogic.User u,string Text) 
		{
		
			int ParentId= -1;
			int level = 1;
			Guid uniqueId = Guid.NewGuid();
			CMSNode n = CMSNode.MakeNew(ParentId, _objectType, u.Id, level,Text, uniqueId);

			ContentType.Create(n.Id, Text,"");
	
			return new MemberType(n.Id);
		}
示例#11
0
 public static ContentItem MakeNew(string Name, ContentItemType cit, BusinessLogic.User u, int ParentId)
 {
     Guid newId = Guid.NewGuid();
     // Updated to match level from base node
     CMSNode n = new CMSNode(ParentId);
     int newLevel = n.Level;
     newLevel++;
     CMSNode.MakeNew(ParentId,_objectType, u.Id, newLevel,  Name, newId);
     ContentItem tmp = new ContentItem(newId);
     tmp.CreateContent(cit);
     return tmp;
 }
示例#12
0
 public Select(DataAccess.AutoMerge.Base.ISelect selectDAL, 
                 BusinessLogic.Branch.Base.ISelect branchSelectBLL,
                 BusinessLogic.AutoMergeSubscription.Base.ISelect autoMergeSubscriptionBLL,
                 BusinessLogic.AutoMergeOptions.Base.ISelect autoMergeOptionsBLL,
                 BusinessLogic.AutoMergeLog.Base.ISelect autoMergeLogSelectBLL)
 {
     this.selectDAL = selectDAL;
     this.branchSelectBLL = branchSelectBLL;
     this.autoMergeSubscriptionBLL = autoMergeSubscriptionBLL;
     this.autoMergeOptionsBLL = autoMergeOptionsBLL;
     this.autoMergeLogSelectBLL = autoMergeLogSelectBLL;
 }
示例#13
0
 public Trigger(BusinessLogic.Core.Base.ISettings settingsBLL,
                 BusinessLogic.Branch.Base.ISelect selectBranchBLL,
                 BusinessLogic.Notifications.Base.ISlack slackNotificationBLL,
                 [Dependency("Svn.ISearchLog")]BusinessLogic.VersionControl.Base.ISearchLog searchLogBLL,
                 [Dependency("Svn.IEligibleRevisions")]BusinessLogic.VersionControl.Base.IEligibleRevisions eligibleRevisions)
 {
     this.settingsBLL = settingsBLL;
     this.selectBranchBLL = selectBranchBLL;
     this.searchLogBLL = searchLogBLL;
     this.slackNotificationBLL = slackNotificationBLL;
     this.eligibleRevisions = eligibleRevisions;
 }
示例#14
0
 public Update(DataAccess.AutoMerge.Base.IUpdate updateDAL, Branch.Base.IInsert insertBranchBLL,
                 BusinessLogic.AutoMergeSubscription.Base.IUpsert autoMergeSubscriptionUpsertBLL,
                 BusinessLogic.AutoMerge.Base.ISchedule scheduleBLL,
                 BusinessLogic.AutoMergeOptions.Base.IUpsert autoMergeOptionsUpsertBLL,
                 BusinessLogic.AutoMerge.Base.ISelect selectAutoMergeBLL)
 {
     this.updateDAL = updateDAL;
     this.insertBranchBLL = insertBranchBLL;
     this.autoMergeSubscriptionUpsertBLL = autoMergeSubscriptionUpsertBLL;
     this.scheduleBLL = scheduleBLL;
     this.autoMergeOptionsUpsertBLL = autoMergeOptionsUpsertBLL;
     this.selectAutoMergeBLL = selectAutoMergeBLL;
 }
示例#15
0
        public Insert(DataAccess.AutoMerge.Base.IInsert insertDAL, 
                        BusinessLogic.Branch.Base.ISelect branchSelectBLL,
                        BusinessLogic.Branch.Base.IInsert insertBranchBLL,
                        BusinessLogic.AutoMergeSubscription.Base.IUpsert autoMergeSubscriptionUpsertBLL,
						BusinessLogic.AutoMerge.Base.ISchedule scheduleBLL,
                        BusinessLogic.AutoMergeOptions.Base.IUpsert autoMergeOptionsUpsertBLL)
        {
            this.insertDAL = insertDAL;
            this.branchSelectBLL = branchSelectBLL;
            this.insertBranchBLL = insertBranchBLL;
            this.autoMergeSubscriptionUpsertBLL = autoMergeSubscriptionUpsertBLL;
            this.scheduleBLL = scheduleBLL;
            this.autoMergeOptionsUpsertBLL = autoMergeOptionsUpsertBLL;
        }
示例#16
0
		public static void MakeNew(BusinessLogic.User User, cms.businesslogic.CMSNode Node, char PermissionKey) 
		{
            IParameter[] parameters = new IParameter[] { SqlHelper.CreateParameter("@userId", User.Id),
                                                         SqlHelper.CreateParameter("@nodeId", Node.Id),
                                                         SqlHelper.CreateParameter("@permission", PermissionKey.ToString()) };

            // Method is synchronized so exists remains consistent (avoiding race condition)
            bool exists = SqlHelper.ExecuteScalar<int>("SELECT COUNT(userId) FROM umbracoUser2nodePermission WHERE userId = @userId AND nodeId = @nodeId AND permission = @permission",
                                                       parameters) > 0;
            if (!exists) {
                SqlHelper.ExecuteNonQuery("INSERT INTO umbracoUser2nodePermission (userId, nodeId, permission) VALUES (@userId, @nodeId, @permission)",
                                          parameters);
                // clear user cache to ensure permissions are re-loaded
                User.GetUser(User.Id).FlushFromCache();
            }
		}
示例#17
0
        /// <summary>
        /// Creates a new Media
        /// </summary>
        /// <param name="Name">The name of the media</param>
        /// <param name="dct">The type of the media</param>
        /// <param name="u">The user creating the media</param>
        /// <param name="ParentId">The id of the folder under which the media is created</param>
        /// <returns></returns>
        public static Media MakeNew(string Name, MediaType dct, BusinessLogic.User u, int ParentId)
        {
            Guid newId = Guid.NewGuid();
            // Updated to match level from base node
            CMSNode n = new CMSNode(ParentId);
            int newLevel = n.Level;
            newLevel++;
            CMSNode.MakeNew(ParentId, _objectType, u.Id, newLevel, Name, newId);
            Media tmp = new Media(newId);
            tmp.CreateContent(dct);

            NewEventArgs e = new NewEventArgs();
            tmp.OnNew(e);

            return tmp;
        }
示例#18
0
        public static Media MakeNew(string Name, MediaType dct, BusinessLogic.User u, int ParentId)
        {
            var e = new NewEventArgs();
            OnNewing(e);
            if (e.Cancel)
            {
                return null;
            }

            var media = ApplicationContext.Current.Services.MediaService.CreateMediaWithIdentity(Name, ParentId, dct.Alias, u.Id);
            //The media object will only have the 'WasCancelled' flag set to 'True' if the 'Creating' event has been cancelled
            if (((Entity)media).WasCancelled)
                return null;

            var tmp = new Media(media);

            tmp.OnNew(e);

            return tmp;
        }
        void ControladorTCP_SegmentoRecibido(object sender, BusinessLogic.Datos.TCPSegmentRecibido e)
        {
            PacketSOA paquete = new PacketSOA();
            paquete.IpOrigen = e.PacketRecibido.IpOrigen;
            paquete.IpDestino = e.PacketRecibido.IpDestino;
            TCPSegmentSOA segment = new TCPSegmentSOA(e.SegmentoTCPRecibido.SourcePort,
                e.SegmentoTCPRecibido.DestinationPort,
                paquete,
                e.SegmentoTCPRecibido.SYN_Flag,
                e.SegmentoTCPRecibido.ACK_Flag,
                e.SegmentoTCPRecibido.SEQ_Number,
                e.SegmentoTCPRecibido.ACK_Number,e.HoraDeTransmision,
                false,
                e.SegmentoTCPRecibido.DataLength,
                e.SegmentoTCPRecibido.FinFlag);
            foreach (IVisualizacion vist in Vistas)
            {
                vist.EnviarInformacionSegmentoRecibido(_pc.Id, segment);

            }
        }
        void CapaDatos_PaqueteDesEncapsulado(object sender, BusinessLogic.Datos.PaqueteDesencapsuladoEventArgs e)
        {
            FrameSOA frameSOA = new FrameSOA();
            frameSOA.MACAddressOrigen = e.Frame.MACAddressOrigen;
            frameSOA.MACAddressDestino = e.Frame.MACAddressDestino;
            Packet paquete = e.Frame.Informacion as Packet;
            PacketSOA packSOA = new PacketSOA();
            packSOA.IpOrigen = paquete.IpOrigen;
            packSOA.IpDestino = paquete.IpDestino;
            packSOA.Datos = paquete.Datos.ToString();
            EncapsulacionSOA encapsulacion = new EncapsulacionSOA();
            encapsulacion.Fecha = e.HoraDeRecepcion;
            encapsulacion.Frame = frameSOA;
            encapsulacion.Paquete = packSOA;
            encapsulacion.IdEquipo = _router.Id;
            encapsulacion.EsEncapsulacion = false;
            foreach (IVisualizacion vist in Vistas)
            {
                vist.EnviarInformacionEncapsulacionRouter(encapsulacion);

            }
        }
示例#21
0
        //[HttpPost]
        public ActionResult Index(HomeModel model)
        {
            //var model = new HomeModel(); // n tier
            // try catch
            //model.WelcomeTextTag = "span";

            try
            {
                BusinessLogic l = new BusinessLogic();
                l.BusinesLogicOperation();
                return null;
            }
            catch (ProjectException e)
            {
                // rekurencja e.InnerException.
            }
            finally
            {

            }

            return View(model);
        }
示例#22
0
        private void FillAllAppointmentsForCurrentWeek(GridViewRowEventArgs e)
        {
            Label cpaID = (Label)e.Row.FindControl("lblCPAID");

            Session["CpaID"] = cpaID.Text;

            Label tempDate = null;

            if (gvCPASearchResult.HeaderRow != null)
            {
                tempDate = (Label)gvCPASearchResult.HeaderRow.FindControl("lblMondayDate");
            }
            if (cpaID != null && tempDate != null)
            {
                DataSet[] result = BusinessLogic.GetAllAppointmentsForWeek(int.Parse(cpaID.Text), (DateTime.Parse(tempDate.Text))).ToArray();
                if (result != null && result.Length > 0)
                {
                    int index1, count;
                    for (index1 = 0, count = 0; index1 < result.Length; index1++)
                    {
                        if (result[index1] == null)
                        {
                            count++;
                        }
                    }
                    if (index1 == count)
                    {
                        e.Row.Cells[2].ColumnSpan = 7;

                        Label lblAppoint = (Label)e.Row.FindControl("lblNoAppointment");

                        lblAppoint.Text = "No Appointment Available";
                        e.Row.Cells.RemoveAt(3);
                        e.Row.Cells.RemoveAt(3);
                        e.Row.Cells.RemoveAt(3);
                        e.Row.Cells.RemoveAt(3);
                        e.Row.Cells.RemoveAt(3);
                        e.Row.Cells.RemoveAt(3);
                    }
                    else
                    {
                        for (int index = 0; index < result.Length; index++)
                        {
                            switch (index)
                            {
                            case 0:
                                FillAppiontmentDetailsRepeater("rptMondayAppointments", e, result, index);
                                break;

                            case 1:
                                FillAppiontmentDetailsRepeater("rptTuesdayAppointments", e, result, index);
                                break;

                            case 2:
                                FillAppiontmentDetailsRepeater("rptWednesdayAppointments", e, result, index);
                                break;

                            case 3:
                                FillAppiontmentDetailsRepeater("rptThursdayAppointments", e, result, index);
                                break;

                            case 4:
                                FillAppiontmentDetailsRepeater("rptFridayAppointments", e, result, index);
                                break;

                            case 5:
                                FillAppiontmentDetailsRepeater("rptSaturdayAppointments", e, result, index);
                                break;

                            case 6:
                                FillAppiontmentDetailsRepeater("rptSundayAppointments", e, result, index);
                                break;

                            default:
                                break;
                            }
                        }
                    }
                }
            }
        }
示例#23
0
        public ActionResult OrderList(string user)
        {
            List <Order> order = BusinessLogic.ListOrdersBy(user);

            return(View(order));
        }
示例#24
0
        public void AddComment(int postId, string text)
        {
            var bl = new BusinessLogic();

            bl.AddComment(postId, text, int.Parse(User.Identity.Name));
        }
        /// <summary>
        /// 加载左侧功能栏项
        /// </summary>
        public void LoadSildeBar(string moduleId)
        {
            var currentid = moduleId;

            DataRow[] drows = ClientCache.Instance.DTUserMoule.Select(PiModuleTable.FieldParentId + " = '" + currentid + "'", PiModuleTable.FieldSortCode);
            if (drows.Length <= 0)
            {
                return;
            }
            bool isSelected = false;

            foreach (DataRow dr in drows)
            {
                //只加载模块类型为1(WinForm类型)或3(WinForm与WebForm相结合)的
                var moduleType = BusinessLogic.ConvertToNullableInt(dr[PiModuleTable.FieldModuleType]);

                if (moduleType != null && moduleType != 1 && moduleType != 3)
                {
                    continue;
                }
                //RibbonTabItem>RibbonPanel>RibbonBar>ButtonItem
                RibbonTabItem ribbonTabItem = new RibbonTabItem {
                    Text = dr[PiModuleTable.FieldFullName].ToString().Trim()
                };
                RibbonPanel ribbonPanel = new RibbonPanel {
                    Text = dr[PiModuleTable.FieldFullName].ToString().Trim()
                };

                if (SystemInfo.MultiLanguage)
                {
                    if (SystemInfo.CurrentLanguage.Equals("zh-TW", StringComparison.OrdinalIgnoreCase))
                    {
                        ribbonTabItem.Text = ChineseStringHelper.StringConvert(ribbonTabItem.Text, 1);
                        ribbonPanel.Text   = ChineseStringHelper.StringConvert(ribbonPanel.Text, 1);
                    }

                    if (SystemInfo.CurrentLanguage.Equals("en-US", StringComparison.OrdinalIgnoreCase))
                    {
                        string code = dr[PiModuleTable.FieldCode].ToString();
                        ribbonTabItem.Text = code.StartsWith("Frm", StringComparison.OrdinalIgnoreCase) ? code.Remove(0, 3) : code;
                        ribbonPanel.Text   = code.StartsWith("Frm", StringComparison.OrdinalIgnoreCase) ? code.Remove(0, 3) : code;
                    }
                }

                ribbonTabItem.Panel = ribbonPanel;
                ribbonPanel.Dock    = DockStyle.Fill;
                if (!isSelected)
                {
                    isSelected = true;
                    ribbonTabItem.Select();
                }
                this.ribbonControlMain.Controls.Add(ribbonPanel);
                this.ribbonControlMain.Items.Add(ribbonTabItem);

                DataRow[] subDrows = ClientCache.Instance.DTUserMoule.Select(PiModuleTable.FieldParentId + " = '" + dr[PiModuleTable.FieldId].ToString() + "'", PiModuleTable.FieldSortCode);
                if (subDrows.Length > 0)
                {
                    RibbonBar rb = new RibbonBar();
                    this.LoadSubItems(subDrows, rb, dr[PiModuleTable.FieldId].ToString());
                    ribbonPanel.Controls.Add(rb);
                }
            }
        }
示例#26
0
        /// <summary>
        /// 保存新增的数据
        /// </summary>
        /// <param name="close">增加成功是否关闭窗体</param>
        private void SaveAddData(bool close)
        {
            if (!BasePageLogic.ControlValueIsEmpty(gbMain))
            {
                return;
            }
            // 设置鼠标繁忙状态,并保留原先的状态
            var holdCursor = this.Cursor;

            this.Cursor = Cursors.WaitCursor;
            var moduleEntity = new PiModuleEntity
            {
                ParentId       = BusinessLogic.ConvertToString(txtParentId.SelectedValue),
                FullName       = txtFullName.Text.Trim(),
                Code           = txtCode.Text.Trim(),
                Target         = txtTarget.Text.Trim(),
                NavigateUrl    = txtNavigateUrl.Text.Trim(),
                MvcNavigateUrl = txtMvcNavigateUrl.Text.Trim(),
                ImageIndex     = SelectedFileId,
                IconUrl        = txtIconUrl.Text.Trim(),
                IconCss        = txtIconCss.Text.Trim(),
                FormName       = txtFormName.Text.Trim(),
                AssemblyName   = txtAssemblyName.Text.Trim(),
                ModuleType     = 3
            };

            if (rbModuleType1.Checked)
            {
                moduleEntity.ModuleType = 1;
            }

            if (rbModuleType2.Checked)
            {
                moduleEntity.ModuleType = 2;
            }

            if (rbModuleType3.Checked)
            {
                moduleEntity.ModuleType = 3;
            }

            if (string.IsNullOrEmpty(moduleEntity.NavigateUrl))
            {
                moduleEntity.NavigateUrl = @"#";
            }
            if (moduleEntity.ModuleType != null && moduleEntity.ModuleType == 2)
            {
                moduleEntity.IconCss = "icon-note";
            }

            moduleEntity.PermissionItemCode = "Resource.AccessPermission";
            moduleEntity.Enabled            = chkEnabled.Checked ? 1 : 0;
            moduleEntity.IsPublic           = chkIsPublic.Checked ? 1 : 0;
            moduleEntity.Expand             = chkExpand.Checked ? 1 : 0;
            moduleEntity.Description        = txtDescription.Text.Trim();
            moduleEntity.AllowDelete        = chkAllowDelete.Checked ? 1 : 0;
            moduleEntity.AllowEdit          = chkAllowEdit.Checked ? 1 : 0;
            moduleEntity.IsMenu             = chkIsMenu.Checked ? 1 : 0;
            moduleEntity.DeleteMark         = 0;

            string statusCode    = string.Empty;
            string statusMessage = string.Empty;

            this.EntityId = moduleService.Add(UserInfo, moduleEntity, out statusCode, out statusMessage);
            this.FullName = moduleEntity.FullName;
            this.ParentId = BusinessLogic.ConvertToString(moduleEntity.ParentId);
            if (statusCode == StatusCode.OKAdd.ToString())
            {
                this.Changed = true;

                if (SystemInfo.ShowInformation)
                {
                    // 添加成功,进行提示
                    MessageBoxHelper.ShowSuccessMsg(statusMessage);
                }
                if (close)
                {
                    this.DialogResult = DialogResult.OK;
                }
                else
                {
                    BasePageLogic.EmptyControlValue(gbMain);
                    this.chkEnabled.Checked     = true;
                    this.chkAllowEdit.Checked   = true;
                    this.chkAllowDelete.Checked = true;
                    txtFullName.Focus();
                }
            }
            else
            {
                MessageBoxHelper.ShowWarningMsg(statusMessage);
                // 是否编号重复了,提高友善性
                if (statusCode == StatusCode.ErrorCodeExist.ToString())
                {
                    this.txtCode.SelectAll();
                    this.txtCode.Focus();
                }
            }
            // 设置鼠标默认状态,原来的光标状态
            this.Cursor = holdCursor;

            if (this.Changed && close)
            {
                this.Close();
            }
        }
示例#27
0
    protected void btnExl_Click(object sender, EventArgs e)
    {
        try
        {
            double   currStock;
            DateTime startDate, endDate;
            startDate            = Convert.ToDateTime(txtStartDate.Text);
            endDate              = Convert.ToDateTime(txtEndDate.Text);
            lblClosingStock.Text = "0";
            sDataSource          = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString();
            //ReportsBL.ReportClass report = new ReportsBL.ReportClass();
            double openingStock = 0;
            //string[] itemAr = drpLedgerName.SelectedItem.Text.Split('|');

            string Branch = drpBranchAdd.SelectedValue;
            if (Branch == "0")
            {
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert(' Please Select Branch. It cannot be Left blank.');", true);
                return;
            }
            else
            {
                int types = Convert.ToInt32(drpsaletype.SelectedValue);

                BusinessLogic bl = new BusinessLogic(sDataSource);

                //string itemCode = Convert.ToString(itemAr[0]).Trim();
                string itemCode = cmbProdAdd.Text;
                lblModel.Text = cmbModel.Text;
                openingStock  = Convert.ToDouble(bl.getOpeningStock(sDataSource, itemCode, Branch)) +
                                (Convert.ToDouble(bl.getOpeningStockPurchase(sDataSource, itemCode, startDate, Branch)) - Convert.ToDouble(bl.getOpeningStockSales(sDataSource, itemCode, startDate, Branch)));

                lblOpenStock.Text = Convert.ToString(openingStock);

                sDataSource = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString();


                currStock = bl.getStockInfo(itemCode, Branch);

                //string[] stkArray = drpLedgerName.SelectedItem.Value.Split('@');
                lblItem.Text           = cmbProdName.Text;
                lblClosingStockPM.Text = Convert.ToString(currStock);
                hdStock.Value          = Convert.ToString(openingStock);


                if ((chkvalue.Checked == false))
                {
                    DataSet dsLedger = bl.getProductStockList(sDataSource, itemCode, startDate, endDate, Branch, types);
                    gvLedger.DataSource = dsLedger;
                    gvLedger.DataBind();

                    //gvLedger.Visible = false;
                    //divReport.Visible = false;

                    ExportToExcel();
                    #region Export To Excel
                    //if (dsLedger.Tables[0].Rows.Count > 0)
                    //{
                    //    DataTable dt = new DataTable();
                    //    dt.Columns.Add(new DataColumn("Bill Date"));
                    //    dt.Columns.Add(new DataColumn("Purchase / Sale"));
                    //    dt.Columns.Add(new DataColumn("Bill No."));
                    //    dt.Columns.Add(new DataColumn("Qty."));
                    //    dt.Columns.Add(new DataColumn("Ledger Name"));

                    //    foreach (DataRow dr in dsLedger.Tables[0].Rows)
                    //    {
                    //        DataRow dr_export = dt.NewRow();
                    //        dr_export["Bill Date"] = dr["billdate"];
                    //        dr_export["Purchase / Sale"] = dr["'Purchase/Sale'"];
                    //        dr_export["Bill No."] = dr["billno"];
                    //        dr_export["Qty."] = dr["qty"];
                    //        dr_export["Ledger Name"] = dr["LedgerName"];
                    //        dt.Rows.Add(dr_export);
                    //    }

                    //    DataRow dr_lastexport = dt.NewRow();
                    //    dr_lastexport["Bill Date"] = "";
                    //    dr_lastexport["Purchase / Sale"] = "";
                    //    dr_lastexport["Bill No."] = "";
                    //    dr_lastexport["Qty."] = "";
                    //    dr_lastexport["Ledger Name"] = "";
                    //    ExportToExcel("StockListReport.xls", dt);
                    //}
                    #endregion
                }
                else if ((chkvalue.Checked == true))
                {
                    DataSet dsLedger = bl.getProductStockList(sDataSource, itemCode, startDate, endDate, Branch, types);
                    gvledgerwithvalue.DataSource = dsLedger;
                    gvledgerwithvalue.DataBind();

                    //gvledgerwithvalue.Visible = false;

                    //divReport.Visible = false;

                    ExportToExcelValue();
                    #region Export To Excel
                    //if (dsLedger.Tables[0].Rows.Count > 0)
                    //{
                    //    DataTable dt = new DataTable();
                    //    dt.Columns.Add(new DataColumn("Bill Date"));
                    //    dt.Columns.Add(new DataColumn("Purchase / Sale"));
                    //    dt.Columns.Add(new DataColumn("Bill No."));
                    //    dt.Columns.Add(new DataColumn("Qty."));
                    //    dt.Columns.Add(new DataColumn("Ledger Name"));
                    //    dt.Columns.Add(new DataColumn("Purchase Value"));
                    //    dt.Columns.Add(new DataColumn("Sales Value"));

                    //    foreach (DataRow dr in dsLedger.Tables[0].Rows)
                    //    {
                    //        DataRow dr_export = dt.NewRow();
                    //        dr_export["Bill Date"] = dr["billdate"];
                    //        dr_export["Purchase / Sale"] = dr["'Purchase/Sale'"];
                    //        dr_export["Bill No."] = dr["billno"];
                    //        dr_export["Qty."] = dr["qty"];
                    //        dr_export["Ledger Name"] = dr["LedgerName"];
                    //        if (dr["'Purchase/Sale'"].ToString() == "PURCHASE")
                    //        {
                    //            dr_export["Purchase Value"] = dr["rate"];
                    //            dr_export["Sales Value"] = "";
                    //        }
                    //        else if (dr["'Purchase/Sale'"].ToString() == "SALES")
                    //        {
                    //            dr_export["Sales Value"] = dr["rate"];
                    //            dr_export["Purchase Value"] = "";
                    //        }
                    //        dt.Rows.Add(dr_export);
                    //    }

                    //    DataRow dr_lastexport = dt.NewRow();
                    //    dr_lastexport["Bill Date"] = "";
                    //    dr_lastexport["Purchase / Sale"] = "";
                    //    dr_lastexport["Bill No."] = "";
                    //    dr_lastexport["Qty."] = "";
                    //    dr_lastexport["Ledger Name"] = "";
                    //    dr_lastexport["Purchase Value"] = "";
                    //    dr_lastexport["Sales Value"] = "";

                    //    ExportToExcel("StockListReport.xls", dt);
                    //}
                    #endregion
                }
                //else
                //{
                //    DataSet dsLedger = bl.getProductStockList(sDataSource, itemCode, startDate, endDate, Branch, types);
                //    gvledgerwithvalue.DataSource = dsLedger;
                //    gvledgerwithvalue.DataBind();

                //    divReport.Visible = false;

                //    ExportToExcelValue();
                //    #region Export To Excel
                //    //if (dsLedger.Tables[0].Rows.Count > 0)
                //    //{
                //    //    DataTable dt = new DataTable();
                //    //    dt.Columns.Add(new DataColumn("Bill Date"));
                //    //    dt.Columns.Add(new DataColumn("Purchase / Sale"));
                //    //    dt.Columns.Add(new DataColumn("Bill No."));
                //    //    dt.Columns.Add(new DataColumn("Qty."));
                //    //    dt.Columns.Add(new DataColumn("Ledger Name"));
                //    //    dt.Columns.Add(new DataColumn("Purchase Value"));
                //    //    dt.Columns.Add(new DataColumn("Sales Value"));

                //    //    foreach (DataRow dr in dsLedger.Tables[0].Rows)
                //    //    {
                //    //        DataRow dr_export = dt.NewRow();
                //    //        if ((dr["'Purchase/Sale'"].ToString() == "IN") || (dr["'Purchase/Sale'"].ToString() == "OUT"))
                //    //        {
                //    //            dr_export["Bill Date"] = dr["cdate"];
                //    //        }
                //    //        else
                //    //        {
                //    //            dr_export["Bill Date"] = dr["billdate"];
                //    //        }
                //    //        dr_export["Purchase / Sale"] = dr["'Purchase/Sale'"];
                //    //        if ((dr["'Purchase/Sale'"].ToString() == "IN") || (dr["'Purchase/Sale'"].ToString() == "OUT"))
                //    //        {
                //    //            dr_export["Bill No."] = dr["compid"];
                //    //        }
                //    //        else
                //    //        {
                //    //            dr_export["Bill No."] = dr["billno"];
                //    //        }
                //    //        dr_export["Qty."] = dr["qty"];
                //    //        dr_export["Ledger Name"] = dr["LedgerName"];
                //    //        if (dr["'Purchase/Sale'"].ToString() == "PURCHASE")
                //    //        {
                //    //            dr_export["Purchase Value"] = dr["rate"];
                //    //            dr_export["Sales Value"] = "";
                //    //        }
                //    //        else if (dr["'Purchase/Sale'"].ToString() == "SALES")
                //    //        {
                //    //            dr_export["Sales Value"] = dr["rate"];
                //    //            dr_export["Purchase Value"] = "";
                //    //        }
                //    //        dt.Rows.Add(dr_export);
                //    //    }

                //    //    DataRow dr_lastexport = dt.NewRow();
                //    //    dr_lastexport["Bill Date"] = "";
                //    //    dr_lastexport["Purchase / Sale"] = "";
                //    //    dr_lastexport["Bill No."] = "";
                //    //    dr_lastexport["Qty."] = "";
                //    //    dr_lastexport["Ledger Name"] = "";
                //    //    dr_lastexport["Purchase Value"] = "";
                //    //    dr_lastexport["Sales Value"] = "";

                //    //    ExportToExcel("StockListReport.xls", dt);
                //    //}
                //    #endregion
                //}
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
示例#28
0
        /// <summary>
        /// 保存修改的数据
        /// </summary>
        private void SaveEditData()
        {
            if (!BasePageLogic.ControlValueIsEmpty(gbMain))
            {
                return;
            }

            // 设置鼠标繁忙状态,并保留原先的状态
            var holdCursor = this.Cursor;

            this.Cursor = Cursors.WaitCursor;
            currentModuleEntity.ParentId       = BusinessLogic.ConvertToString(txtParentId.SelectedValue);
            currentModuleEntity.FullName       = txtFullName.Text.Trim();
            currentModuleEntity.Code           = txtCode.Text.Trim();
            currentModuleEntity.Target         = txtTarget.Text.Trim();
            currentModuleEntity.NavigateUrl    = txtNavigateUrl.Text.Trim();
            currentModuleEntity.MvcNavigateUrl = txtMvcNavigateUrl.Text.Trim();
            currentModuleEntity.IconUrl        = txtIconUrl.Text.Trim();
            currentModuleEntity.IconCss        = txtIconCss.Text.Trim();
            currentModuleEntity.FormName       = txtFormName.Text.Trim();
            currentModuleEntity.AssemblyName   = txtAssemblyName.Text.Trim();
            if (rbModuleType1.Checked)
            {
                currentModuleEntity.ModuleType = 1;
            }

            if (rbModuleType2.Checked)
            {
                currentModuleEntity.ModuleType = 2;
            }

            if (rbModuleType3.Checked)
            {
                currentModuleEntity.ModuleType = 3;
            }
            currentModuleEntity.Enabled     = chkEnabled.Checked ? 1 : 0;
            currentModuleEntity.IsPublic    = chkIsPublic.Checked ? 1 : 0;
            currentModuleEntity.Expand      = chkExpand.Checked ? 1 : 0;
            currentModuleEntity.AllowDelete = chkAllowDelete.Checked ? 1 : 0;
            currentModuleEntity.AllowEdit   = chkAllowEdit.Checked ? 1 : 0;
            currentModuleEntity.IsMenu      = chkIsMenu.Checked ? 1 : 0;
            currentModuleEntity.Description = txtDescription.Text.Trim();
            if (!string.IsNullOrEmpty(SelectedFileId.Trim()))
            {
                currentModuleEntity.ImageIndex = SelectedFileId;
            }

            string statusCode    = string.Empty;
            string statusMessage = string.Empty;

            this.EntityId = currentModuleEntity.Id.ToString();
            this.FullName = currentModuleEntity.FullName;
            this.ParentId = BusinessLogic.ConvertToString(currentModuleEntity.ParentId);
            moduleService.Update(UserInfo, currentModuleEntity, out statusCode, out statusMessage);

            if (statusCode == StatusCode.OKUpdate.ToString())
            {
                this.Changed = true;

                if (SystemInfo.ShowInformation)
                {
                    // 添加成功,进行提示
                    MessageBoxHelper.ShowSuccessMsg(statusMessage);
                }
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                MessageBoxHelper.ShowWarningMsg(statusMessage);
                // 是否编号重复了,提高友善性
                if (statusCode == StatusCode.ErrorCodeExist.ToString())
                {
                    this.txtCode.SelectAll();
                    this.txtCode.Focus();
                }
            }
            // 设置鼠标默认状态,原来的光标状态
            this.Cursor = holdCursor;

            if (this.Changed)
            {
                this.Close();
            }
        }
        private void SaveData()
        {
            //保存任务
            NowTask.TaskName    = tbxTaskName.Text;
            NowTask.Description = tbxTaskDes.Text;

            if (rbtShareUser.Checked)
            {
                NowTask.OperRule = "1";
            }
            else
            if (rbtEveryUser.Checked)
            {
                NowTask.OperRule = "2";
            }
            NowTask.SaveUpdateTask();
            RDIFrameworkService.Instance.WorkFlowTemplateService.DeleteWorkTaskAllOperator(this.UserInfo, NowTask.TaskId);
            //保存处理者
            foreach (ListViewItem lt in lvExOper.Items)
            {
                var oper = new OperatorEntity
                {
                    OperatorId  = lt.SubItems[1].Text,
                    WorkFlowId  = NowTask.WorkFlowId,
                    WorkTaskId  = NowTask.TaskId,
                    Description = lt.Text,
                    OperType    = Convert.ToInt16(lt.SubItems[3].Text),
                    Relation    = Convert.ToInt16(lt.SubItems[4].Text),
                    OperContent = lt.SubItems[5].Text,
                    OperDisplay = lt.SubItems[6].Text
                };

                switch (lt.SubItems[2].Text)
                {
                case "包含":
                    oper.InorExclude = 1;
                    break;

                case "排除":
                    oper.InorExclude = 0;
                    break;
                }

                RDIFrameworkService.Instance.WorkFlowTemplateService.InsertOperator(this.UserInfo, oper);
            }

            //保存任务命令
            RDIFrameworkService.Instance.WorkFlowTemplateService.DeleteWorkTaskAllCommands(this.UserInfo, NowTask.TaskId);
            foreach (ListViewItem lt in lvExCommand.Items)
            {
                var taskCommand = new WorkTaskCommandsEntity
                {
                    WorkFlowId  = NowTask.WorkFlowId,
                    WorkTaskId  = NowTask.TaskId,
                    CommandName = lt.Text,
                    CommandId   = lt.SubItems[1].Text,
                    Description = lt.SubItems[2].Text
                };
                RDIFrameworkService.Instance.WorkFlowTemplateService.InsertWorkTaskCommands(this.UserInfo, taskCommand);
            }


            //保存关联表单
            RDIFrameworkService.Instance.WorkFlowTemplateService.DeleteWorkTaskAllControls(this.UserInfo, NowTask.TaskId);
            RDIFrameworkService.Instance.WorkFlowTemplateService.SetWorkTaskUserCtrls(this.UserInfo, UserControlId, NowTask.WorkFlowId, NowTask.TaskId);

            //保存事件
            RDIFrameworkService.Instance.WorkFlowTemplateService.DeleteWorkFlowEvent(this.UserInfo, NowTask.TaskId);
            var ev = new WorkFlowEventEntity
            {
                Guid       = BusinessLogic.NewGuid(),
                WorkFlowId = NowTask.WorkFlowId,
                WorkTaskId = NowTask.TaskId
            };
            var us = "";

            ev.RmMsg   = cbxRmMessage.Checked ? 1 : 0;
            ev.RmEmail = cbxRmMail.Checked ? 1 : 0;
            ev.RmSms   = cbxRmSms.Checked ? 1 : 0;

            us = "";
            if (lbxRmMsgToUsers.Items.Count > 0)
            {
                for (var i = 0; i < lbxRmMsgToUsers.Items.Count - 1; i++)
                {
                    us = us + lbxRmMsgToUsers.Items[i].ToString() + ",";
                }
                us = us + lbxRmMsgToUsers.Items[lbxRmMsgToUsers.Items.Count - 1];
            }
            ev.RmToUsers = us;
            RDIFrameworkService.Instance.WorkFlowTemplateService.InsertWorkFlowEvent(this.UserInfo, ev);
        }
示例#30
0
        internal static MediaType MakeNew(BusinessLogic.User u, string text, int parentId)
        {
            var mediaType = new Umbraco.Core.Models.MediaType(parentId) { Name = text, Alias = text, CreatorId = u.Id, Thumbnail = "folder.png", Icon = "folder.gif" };
            ApplicationContext.Current.Services.ContentTypeService.Save(mediaType, u.Id);
            var mt = new MediaType(mediaType.Id);

            NewEventArgs e = new NewEventArgs();
            mt.OnNew(e);

            return mt;
        }
		public static StylesheetProperty MakeNew(string Text, StyleSheet sheet, BusinessLogic.User user) {
			CMSNode newNode = CMSNode.MakeNew(sheet.Id, moduleObjectType, user.Id, 2, Text, Guid.NewGuid());
			Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(_ConnString,CommandType.Text,"Insert into cmsStylesheetProperty (nodeId,stylesheetPropertyAlias,stylesheetPropertyValue) values ('"+ newNode.Id +"','" + Text+ "','')");
			return new StylesheetProperty(newNode.Id);
			
		}
示例#32
0
        public static Template MakeNew(string Name, BusinessLogic.User u)
        {
            //ensure unique alias
            if (GetByAlias(Name) != null)
                Name = EnsureUniqueAlias(Name, 1);

            // CMSNode MakeNew(int parentId, Guid objectType, int userId, int level, string text, Guid uniqueID)
            CMSNode n = CMSNode.MakeNew(-1, _objectType, u.Id, 1, Name, Guid.NewGuid());
            Name = Name.Replace("/", ".").Replace("\\", "");

            if (Name.Length > 100)
                Name = Name.Substring(0, 95) + "...";

            SqlHelper.ExecuteNonQuery("INSERT INTO cmsTemplate (NodeId, Alias, design, master) VALUES (@nodeId, @alias, @design, @master)",
                                      SqlHelper.CreateParameter("@nodeId", n.Id),
                                      SqlHelper.CreateParameter("@alias", Name),
                                      SqlHelper.CreateParameter("@design", ' '),
                                      SqlHelper.CreateParameter("@master", DBNull.Value));

            Template t = new Template(n.Id);
            NewEventArgs e = new NewEventArgs();
            t.OnNew(e);

            return t;
        }
    protected void cmdSave_Click(object sender, EventArgs e)
    {
        try
        {
            if (Page.IsValid)
            {
                err.Text = "";
                //long diff = DateDiff(DateInterval.Day, Convert.ToDateTime(txtDate.Text), DateTime.Now);

                //if (diff<=0)
                //{
                //    //ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Date should be less than or equal to today')", true);
                //    err.Text ="Date should be less than or equal to today";
                //    cmdSave.Enabled = false;
                //    return;
                //}

                if (EditableGrid.Rows.Count <= 0)
                {
                    return;
                }

                if (txtDate.Text.Trim() == "")
                {
                    err.Visible = true;
                    err.Text    = "Date is Blank";
                    return;
                }
                else
                {
                    err.Text = "";
                }
                if (Convert.ToDateTime(txtDate.Text) > DateTime.Now)
                {
                    err.Visible     = true;
                    err.Text        = "Date should be less than or equal to today";
                    cmdSave.Enabled = false;
                    return;
                }
                sDataSource = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString();
                string itemCode    = string.Empty;
                string closingDate = string.Empty;

                string Branch = drpBranchAdd.SelectedValue;

                BusinessLogic bl = new BusinessLogic(sDataSource);
                bl.DeleteClosingStock(txtDate.Text, Branch);
                if (EditableGrid.Rows.Count > 0)
                {
                    foreach (GridViewRow gr in EditableGrid.Rows)
                    {
                        TextBox txtStock = (TextBox)gr.Cells[4].FindControl("txtStock");
                        itemCode = gr.Cells[0].Text.Replace("&quot;", "\"");

                        if (itemCode.Contains("&amp;"))
                        {
                            itemCode = itemCode.Replace("&amp;", "&");
                        }

                        closingDate = txtDate.Text;
                        if (txtStock.Text.Trim() != "")
                        {
                            bl.InsertClosingStock(@itemCode, closingDate, Convert.ToDouble(txtStock.Text), Branch);
                        }
                        else
                        {
                            //ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Check the stock value some might be not given or entered wrongly')", true);
                            err.Visible = true;
                            err.Text    = "Check the stock value some might be not given or entered wrongly";
                            return;
                        }
                    }
                }

                //ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Physical stock values are stored for the date:" + closingDate + "')", true);
                err.Visible = true;
                err.Text    = "Physical stock values are stored for the date: " + closingDate;
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
示例#34
0
        protected void btnBookAppointment_Click(object sender, EventArgs e)
        {
            string scheduleDateID = Request.QueryString["ID"];

            if (BusinessLogic.GetSCheduleMaxAppointment(Session["userID"].ToString()) >= BusinessLogic.GetFirmSettingValue("MaxAppointmentCount"))
            {
                pnlMaxBook.Visible = true;
                //pnlCPADetails.Visible = false;
                pnlEditCustomerDetails.Visible = false;
                pnlCustomerDetails.Visible     = false;
                pnlBookedAppointment.Visible   = false;
                return;
            }
            if (!BusinessLogic.IsBookAppointmentAvailable(Request.QueryString["ID"].ToString()))
            {
                pnlBookedAppointment.Visible   = true;
                pnlMaxBook.Visible             = false;
                pnlEditCustomerDetails.Visible = false;
                pnlCustomerDetails.Visible     = false;
                return;
            }

            bool result = BusinessLogic.BookNewAppointment(Request.QueryString["CPAID"], Request.QueryString["UserID"], lblPurposeOfVisit.Text, scheduleDateID);

            if (result)
            {
                SendEmail();
                string redirectURL = string.Format("~/CPA/FinishBookingApp.aspx?CPAID={0}&Schedule={1}&Purpose={2}&ID={3}&UserID={4}", Request.QueryString["CPAID"], lblScheduleDate.Text, lblPurposeOfVisit.Text, Request.QueryString["ID"], Request.QueryString["UserID"]);
                Response.Redirect(redirectURL);
            }
        }
示例#35
0
    protected void btndetails_Click(object sender, EventArgs e)
    {
        try
        {
            DateTime startDate, endDate;
            int      iLedgerID = 0;

            //string sDataSource = Server.MapPath(ConfigurationSettings.AppSettings["DataSource"].ToString());
            //    string sDataSource = Server.MapPath("App_Data\\Store0910.mdb");

            //  ReportsBL.ReportClass rptBankReport;
            bnkPanel.Visible = true;

            iLedgerID         = Convert.ToInt32(drpBankName.SelectedItem.Value);
            startDate         = Convert.ToDateTime(txtStartDate.Text);
            endDate           = Convert.ToDateTime(txtEndDate.Text);
            lblStartDate.Text = txtStartDate.Text;
            lblEndDate.Text   = txtEndDate.Text;
            // rptBankReport = new ReportsBL.ReportClass();
            BusinessLogic bl = new BusinessLogic(sDataSource);
            DataSet       ds = bl.generateReportDS(iLedgerID, startDate, endDate, sDataSource, 0);

            double credit = 0;
            double debit  = 0;


            #region Export To Excel
            if (ds.Tables[0].Rows.Count > 0)
            {
                DataTable dt = new DataTable("Bank Statement");
                dt.Columns.Add(new DataColumn("Date"));
                dt.Columns.Add(new DataColumn("Particulars"));
                dt.Columns.Add(new DataColumn("BranchCode"));
                dt.Columns.Add(new DataColumn("Voucher Type"));
                dt.Columns.Add(new DataColumn("Debit"));
                dt.Columns.Add(new DataColumn("Credit"));

                DataRow dr_export1 = dt.NewRow();
                dt.Rows.Add(dr_export1);

                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    DataRow dr_export = dt.NewRow();
                    dr_export["Date"]         = dr["Date"];
                    dr_export["Particulars"]  = dr["Particulars"];
                    dr_export["BranchCode"]   = dr["BranchCode"];
                    dr_export["Voucher Type"] = dr["VoucherType"];
                    dr_export["Debit"]        = dr["Debit"];
                    debit = debit + Convert.ToDouble(dr["Debit"]);
                    dr_export["Credit"] = dr["Credit"];
                    credit = credit + Convert.ToDouble(dr["credit"]);
                    dt.Rows.Add(dr_export);
                }

                DataRow dr_export2 = dt.NewRow();
                dr_export2["Date"]         = "";
                dr_export2["Particulars"]  = "";
                dr_export2["BranchCode"]   = "";
                dr_export2["Voucher Type"] = "";
                dr_export2["Debit"]        = "";
                dr_export2["Credit"]       = "";
                dt.Rows.Add(dr_export2);

                DataRow dr_export213 = dt.NewRow();
                dr_export213["Date"]         = "";
                dr_export213["Particulars"]  = "Total";
                dr_export213["BranchCode"]   = "";
                dr_export213["Voucher Type"] = "";
                dr_export213["Debit"]        = debit;
                dr_export213["Credit"]       = credit;
                dt.Rows.Add(dr_export213);

                DataRow dr_export21 = dt.NewRow();
                dr_export21["Date"]         = "";
                dr_export21["Particulars"]  = "";
                dr_export21["BranchCode"]   = "";
                dr_export21["Voucher Type"] = "";
                dr_export21["Debit"]        = "";
                dr_export21["Credit"]       = "";
                dt.Rows.Add(dr_export21);

                double Diffamt = 0;
                Diffamt = debit - credit;

                DataRow dr_export23 = dt.NewRow();
                dr_export23["Date"]         = "";
                dr_export23["Particulars"]  = "Difference";
                dr_export23["BranchCode"]   = "";
                dr_export23["Voucher Type"] = "";
                if (Diffamt >= 0)
                {
                    dr_export23["Debit"]  = Diffamt;
                    dr_export23["Credit"] = 0;
                }
                else if (Diffamt <= 0)
                {
                    dr_export23["Debit"] = 0;
                    if (Diffamt < 0)
                    {
                        dr_export23["Credit"] = -Diffamt;
                    }
                    else
                    {
                        dr_export23["Credit"] = Diffamt;
                    }
                }
                dt.Rows.Add(dr_export23);

                ExportToExcel("Bank Statement.xlsx", dt);
            }
            #endregion
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
        /// <summary>
        /// Creates a new datatypedefinition given its name and the user which creates it.
        /// </summary>
        /// <param name="u">The user who creates the datatypedefinition</param>
        /// <param name="Text">The name of the DataTypeDefinition</param>
        /// <param name="UniqueId">Overrides the CMSnodes uniqueID</param>
        /// <returns></returns>
        public static DataTypeDefinition MakeNew(BusinessLogic.User u, string Text, Guid UniqueId)
        {

            int newId = CMSNode.MakeNew(-1, _objectType, u.Id, 1, Text, UniqueId).Id;
            cms.businesslogic.datatype.controls.Factory f = new cms.businesslogic.datatype.controls.Factory();

            // initial control id changed to empty to ensure that it'll always work no matter if 3rd party configurators fail
            // ref: http://umbraco.codeplex.com/workitem/29788
            Guid FirstcontrolId = Guid.Empty;

            SqlHelper.ExecuteNonQuery("Insert into cmsDataType (nodeId, controlId, dbType) values (" + newId.ToString() + ",@controlId,'Ntext')",
                SqlHelper.CreateParameter("@controlId", FirstcontrolId));

            DataTypeDefinition dtd = new DataTypeDefinition(newId);
            dtd.OnNew(EventArgs.Empty);

            return dtd;
        }
示例#37
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                if (Request.Cookies["Company"] != null)
                {
                    sDataSource = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString();
                }

                DataSet       companyInfo = new DataSet();
                BusinessLogic bl          = new BusinessLogic(sDataSource);
                lblBillDate.Text = DateTime.Now.ToShortDateString();

                txtStartDate.Text = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).ToShortDateString();

                DateTime indianStd = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.Now, "India Standard Time");
                string   dtaa      = Convert.ToDateTime(indianStd).ToString("dd/MM/yyyy");
                txtEndDate.Text = dtaa;

                //txtEndDate.Text = DateTime.Now.ToShortDateString();

                if (Request.Cookies["Company"] != null)
                {
                    companyInfo = bl.getCompanyInfo(Request.Cookies["Company"].Value);

                    if (companyInfo != null)
                    {
                        if (companyInfo.Tables[0].Rows.Count > 0)
                        {
                            foreach (DataRow dr in companyInfo.Tables[0].Rows)
                            {
                                lblTNGST.Text   = Convert.ToString(dr["TINno"]);
                                lblCompany.Text = Convert.ToString(dr["CompanyName"]);
                                lblPhone.Text   = Convert.ToString(dr["Phone"]);
                                lblGSTno.Text   = Convert.ToString(dr["GSTno"]);

                                lblAddress.Text = Convert.ToString(dr["Address"]);
                                lblCity.Text    = Convert.ToString(dr["city"]);
                                lblPincode.Text = Convert.ToString(dr["Pincode"]);
                                lblState.Text   = Convert.ToString(dr["state"]);
                            }
                        }
                    }
                }



                DateTime startDate, endDate;
                if (Request.Cookies["Company"] != null)
                {
                    sDataSource = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString();
                }

                DateTime stdt = Convert.ToDateTime(txtStartDate.Text);
                DateTime etdt = Convert.ToDateTime(txtEndDate.Text);

                if (Request.QueryString["startDate"] != null)
                {
                    stdt = Convert.ToDateTime(Request.QueryString["startDate"].ToString());
                }
                if (Request.QueryString["endDate"] != null)
                {
                    etdt = Convert.ToDateTime(Request.QueryString["endDate"].ToString());
                }

                startDate = Convert.ToDateTime(stdt);
                endDate   = Convert.ToDateTime(etdt);

                var rptSalesReport = new ReportsBL.ReportClass();

                DataSet ds = rptSalesReport.generatePurchaseLevel1Report(startDate, endDate, sDataSource);
                gvPurchaseLevel1.DataSource = ds;
                gvPurchaseLevel1.DataBind();

                ds = rptSalesReport.generatePurchaseLevel2Report(startDate, endDate, sDataSource);
                gvPurchaseLevel2.DataSource = ds;
                gvPurchaseLevel2.DataBind();

                ds = rptSalesReport.generatePurchaseLevel3Report(startDate, endDate, sDataSource);
                gvPurchaseLevel3.DataSource = ds;
                gvPurchaseLevel3.DataBind();

                ds = rptSalesReport.generatePurchaseLevel4Report(startDate, endDate, sDataSource);
                gvPurchaseLevel4.DataSource = ds;
                gvPurchaseLevel4.DataBind();

                divPrint.Visible = true;
                div1.Visible     = false;
                divmain.Visible  = true;
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
示例#38
0
    protected void btnReport_Click(object sender, EventArgs e)
    {
        try
        {
            if (cmbProdAdd.SelectedItem.Text == "Select ItemCode")
            {
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Select any one ItemCode')", true);
                return;
            }

            double   currStock;
            DateTime startDate, endDate;
            startDate            = Convert.ToDateTime(txtStartDate.Text);
            endDate              = Convert.ToDateTime(txtEndDate.Text);
            lblClosingStock.Text = "0";
            sDataSource          = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString();
            ReportsBL.ReportClass report = new ReportsBL.ReportClass();
            double openingStock          = 0;
            //string[] itemAr = drpLedgerName.SelectedItem.Text.Split('|');

            string Branch = drpBranchAdd.SelectedValue;

            if (Branch == "0")
            {
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert(' Please Select Branch. It cannot be Left blank.');", true);
                return;
            }
            else
            {
                int types = Convert.ToInt32(drpsaletype.SelectedValue);

                BusinessLogic bl = new BusinessLogic(sDataSource);

                //string itemCode = Convert.ToString(itemAr[0]).Trim();
                string itemCode = cmbProdAdd.Text;
                lblModel.Text = cmbModel.Text;
                openingStock  = Convert.ToDouble(bl.getOpeningStock(sDataSource, itemCode, Branch)) +
                                (Convert.ToDouble(bl.getOpeningStockPurchase(sDataSource, itemCode, startDate, Branch)) - Convert.ToDouble(bl.getOpeningStockSales(sDataSource, itemCode, startDate, Branch)));

                lblOpenStock.Text = Convert.ToString(openingStock);

                sDataSource = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString();


                currStock = bl.getStockInfo(itemCode, Branch);

                // string[] stkArray = drpLedgerName.SelectedItem.Value.Split('@');
                lblItem.Text           = cmbProdName.Text;
                lblClosingStockPM.Text = Convert.ToString(currStock);
                hdStock.Value          = Convert.ToString(openingStock);
                string Item  = cmbProdName.Text;
                string Model = cmbModel.Text;

                if ((chkvalue.Checked == false))
                {
                    divReport.Visible = false;

                    Response.Write("<script language='javascript'> window.open('StockListReport1.aspx?itemCode=" + itemCode + "&Model=" + Model + "&Item=" + Item + "&startDate=" + Convert.ToDateTime(startDate) + "&endDate=" + Convert.ToDateTime(endDate) + "&Branch=" + Branch + "&Type=" + types + " ' , 'window','height=700,width=1000,left=172,top=10,toolbar=yes,scrollbars=yes,resizable=yes');</script>");
                }
                else if ((chkvalue.Checked == true))
                {
                    divReport.Visible = false;

                    Response.Write("<script language='javascript'> window.open('StockListReport1.aspx?itemCode=" + itemCode + "&Model=" + Model + "&Item=" + Item + "&startDate=" + Convert.ToDateTime(startDate) + "&endDate=" + Convert.ToDateTime(endDate) + "&Branch=" + Branch + "&Type=" + types + "&Check=" + chkvalue.Checked + " ' , 'window','height=700,width=1000,left=172,top=10,toolbar=yes,scrollbars=yes,resizable=yes');</script>");
                }
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
        private void InitData()
        {
            tbxTaskName.Text = NowTask.TaskName;
            tbxTaskDes.Text  = NowTask.Description;

            switch (NowTask.OperRule)
            {
            case "1":
                rbtShareUser.Checked = true;
                break;

            case "2":
                rbtEveryUser.Checked = true;
                break;
            }

            //*********任务命令
            lvExCommand.Columns.Add("处理命令", 200, HorizontalAlignment.Left);
            lvExCommand.Columns.Add("CommandId", 0, HorizontalAlignment.Left);
            lvExCommand.Columns.Add("描述", 100, HorizontalAlignment.Left);
            var taskCommand = RDIFrameworkService.Instance.WorkFlowTemplateService.GetWorkTaskCommands(this.UserInfo, NowTask.WorkFlowId, NowTask.TaskId);

            foreach (DataRow dr in taskCommand.Rows)
            {
                var lvi1 = new ListViewItem(dr[WorkTaskCommandsTable.FieldCommandName].ToString(), 0);
                lvi1.SubItems.Add(dr[WorkTaskCommandsTable.FieldCommandId].ToString());
                lvi1.SubItems.Add(dr[WorkTaskCommandsTable.FieldDescription].ToString());
                lvExCommand.Items.Add(lvi1);
            }

            //*********处理者
            lvExOper.Columns.Add("处理者信息", 200, HorizontalAlignment.Left);
            lvExOper.Columns.Add("OperatorId", 0, HorizontalAlignment.Left);
            lvExOper.Columns.Add("包含/排除", 100, HorizontalAlignment.Left);
            lvExOper.Columns.Add("处理类型", 0, HorizontalAlignment.Left);
            lvExOper.Columns.Add("处理策略", 0, HorizontalAlignment.Left);
            lvExOper.Columns.Add("处理者", 0, HorizontalAlignment.Left);
            lvExOper.Columns.Add("operDisplay", 0, HorizontalAlignment.Left);
            var operTable = RDIFrameworkService.Instance.WorkFlowTemplateService.GetWorkTaskOperator(this.UserInfo, NowTask.WorkFlowId, NowTask.TaskId);

            foreach (DataRow dr in operTable.Rows)
            {
                var lvi1 = new ListViewItem(dr[OperatorTable.FieldDescription].ToString(), 0);
                lvi1.SubItems.Add(dr[OperatorTable.FieldOperatorId].ToString());
                lvi1.SubItems.Add(Convert.ToBoolean(dr[OperatorTable.FieldInorExclude]) ? "包含" : "排除");
                lvi1.SubItems.Add(dr[OperatorTable.FieldOperType].ToString());
                lvi1.SubItems.Add(dr[OperatorTable.FieldRelation].ToString());
                lvi1.SubItems.Add(dr[OperatorTable.FieldOperContent].ToString());
                lvi1.SubItems.Add(dr[OperatorTable.FieldOperDisplay].ToString());
                lvExOper.Items.Add(lvi1);
            }

            //*********表单

            var ctrlTable = RDIFrameworkService.Instance.WorkFlowTemplateService.GetWorkTaskControls(this.UserInfo, NowTask.TaskId);

            if (ctrlTable != null && ctrlTable.Rows.Count > 0)
            {
                tbxFormName.Text = ctrlTable.Rows[0]["MFULLNAME"].ToString();
                UserControlId    = ctrlTable.Rows[0]["USERCONTROLID"].ToString();
            }

            //********* 事件通知
            var ev = RDIFrameworkService.Instance.WorkFlowTemplateService.GetWorkFlowEventInfo(this.UserInfo, NowTask.TaskId);

            if (ev != null)
            {
                cbxRmMail.Checked    = BusinessLogic.ConvertIntToBoolean(ev.RmEmail);
                cbxRmMessage.Checked = BusinessLogic.ConvertIntToBoolean(ev.RmMsg);
                cbxRmSms.Checked     = BusinessLogic.ConvertIntToBoolean(ev.RmSms);
                if (ev.RmToUsers != null)
                {
                    var us = ev.RmToUsers.Split(',');
                    foreach (var usr in us.Where(usr => usr.Length > 0))
                    {
                        lbxRmMsgToUsers.Items.Add(usr);
                    }
                }
            }
        }
示例#40
0
        private void QueryLog()
        {
            if (txtStartDate.Value > txtEndDate.Value)
            {
                MessageBoxHelper.ShowWarningMsg(RDIFrameworkMessage.MSG0208);
                txtStartDate.Focus();
                return;
            }

            try
            {
                this.Cursor = Cursors.WaitCursor;
                var whereStatement = " 1 = 1";

                if (this.ucUserSelect.SelectedIds != null && this.ucUserSelect.SelectedIds.Length > 0)
                {
                    whereStatement += "  and " + CiLogTable.FieldCreateUserId + " IN (" + BusinessLogic.ArrayToList(ucUserSelect.SelectedIds, "'") + ")";
                }
                else if (this.ucUserSelect.SelectedId != null)
                {
                    whereStatement += "  and " + CiLogTable.FieldCreateUserId + " ='" + this.ucUserSelect.SelectedId + "'";
                }

                if (SystemInfo.RDIFrameworkDbType == CurrentDbType.Oracle)
                {
                    whereStatement += " and " + CiLogTable.FieldCreateOn + ">=" + BusinessLogic.GetOracleDateFormat(txtStartDate.Value);
                    whereStatement += " and " + CiLogTable.FieldCreateOn + "<" + BusinessLogic.GetOracleDateFormat(txtEndDate.Value.AddDays(1));
                }
                else
                {
                    whereStatement += " and " + CiLogTable.FieldCreateOn + ">='" + txtStartDate.Value.ToString("yyyy-MM-dd") + "'";
                    whereStatement += " and " + CiLogTable.FieldCreateOn + "<'" + txtEndDate.Value.AddDays(1).ToString("yyyy-MM-dd") + "'";
                }

                var recordCount = 0;
                this.dtLog            = RDIFrameworkService.Instance.LogService.GetDTByPage(this.UserInfo, out recordCount, ucPagerEx.PageIndex, ucPagerEx.PageSize, whereStatement, CiLogTable.FieldCreateOn + " DESC");
                ucPagerEx.RecordCount = recordCount;
                ucPagerEx.InitPageInfo();
                this.dgvInfo.AutoGenerateColumns = false;
                this.dgvInfo.DataSource          = this.dtLog.DefaultView;
                SetControlState();
            }
            catch (Exception ex)
            {
                base.ProcessException(ex);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
示例#41
0
 protected void ddlYear_SelectedIndexChanged(object sender, EventArgs e)
 {
     BusinessLogic.GetAcademicYear(currentUser.ToString().Trim());
 }
示例#42
0
        protected void btnRegister_Click(object sender, EventArgs e)
        {
            try
            {
                List <String> resultList     = new List <string>();
                String        imageName      = ConfigurationManager.AppSettings["DefaultImage"].ToString();
                BusinessLogic businessLogic  = new BusinessLogic();
                var           fieldValueList = new Dictionary <string, string>();
                DataTable     dtExists       = new DataTable();
                string        checkExists    = "select * from " + ConfigurationManager.AppSettings["Farmer_Info"].ToString() + " where Email='" + txtEmail.Text + "'" +
                                               " or Contact_No='" + txtContactno.Text + "' or Username='******'";
                dtExists = businessLogic.GetQueryResult(checkExists);
                if (dtExists.Rows.Count > 0)
                {
                    lblMsg.Text      = "Registration Failed.Email / Contac_No / UserName are Exists";
                    lblMsg.ForeColor = System.Drawing.Color.Red;
                }
                else
                {
                    fieldValueList.Add("Master_Type_ID", "2");
                    fieldValueList.Add("Name", "'" + txtFarmerName.Text + "'");
                    fieldValueList.Add("Email", "'" + txtEmail.Text + "'");
                    fieldValueList.Add("Contact_No", "'" + txtContactno.Text + "'");
                    fieldValueList.Add("Address", "'" + txtAddress.Text + "'");
                    fieldValueList.Add("City", "'" + txtCity.Text + "'");
                    fieldValueList.Add("District_ID", "'" + ddlDistrict.SelectedItem.Value + "'");
                    fieldValueList.Add("State_ID", "'" + ddlState.SelectedItem.Value + "'");
                    fieldValueList.Add("Reg_Card_No", "'" + txtFarmerCardNo.Text + "'");
                    fieldValueList.Add("Username", "'" + txtUserName.Text + "'");
                    fieldValueList.Add("Password", "'" + txtPassword.Text + "'");

                    if (photoUpload.FileName != "")
                    {
                        fieldValueList.Add("Photo", "'" + photoUpload.FileName + "'");
                    }
                    else
                    {
                        fieldValueList.Add("Photo", "'" + imageName + "'");
                    }
                    if (photoUpload.HasFile)
                    {
                        string extension = Path.GetExtension(photoUpload.PostedFile.FileName);
                        photoUpload.PostedFile.SaveAs(Server.MapPath("~/User_Images/") + DateTime.Now.ToString("MMddyyyyHHmmss") + extension);
                    }
                    resultList = businessLogic.InsertRecord(ConfigurationManager.AppSettings["Farmer_Info"].ToString(), fieldValueList);
                    if (resultList.Count > 1)
                    {
                        lblMsg.Text               = "Hi," + txtFarmerName.Text + " you have successfully registered";
                        lblMsg.ForeColor          = System.Drawing.Color.Green;
                        linkRedirect.Visible      = true;
                        linkRedirect.PostBackUrl  = "~/FarmerDashboard.aspx?mode=normal&id=" + resultList[1];
                        Session["Id"]             = resultList[1];
                        Session["Master_Type_ID"] = "2";
                        Session["Name"]           = txtFarmerName.Text.ToString();
                        Session["Email"]          = txtEmail.Text.ToString();
                    }
                    else
                    {
                        lblMsg.Text      = "Registration Failed.Please Contact Support Team";
                        lblMsg.ForeColor = System.Drawing.Color.Red;
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
        public void TestConstructor()
        {
            dynamic iDataInterface = new ExpandoObject();

            var bLogic = new BusinessLogic(iDataInterface);
        }
示例#44
0
        static void Main(string[] args)
        {
            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            Console.WriteLine(String.Format("{0}{1}{0}", new String('=', 5), DateTime.Now));
            //TimeSpan timeSpan = new TimeSpan(0, 2, 10, 30, 0);
            //timeSpan = new TimeSpan(timeSpan.Ticks / 2);
            //Console.WriteLine("Done [{0:d\\.hh\\:mm\\:ss}]/per.", timeSpan);
            //Console.WriteLine("Done [{0}]/per.", new TimeSpan(0, 2, 3, 4, 5));
#if DEBUG
            args = new string[] { "UM" };    //S,U
#endif
            if (args == null || args.Length != 1)
            {
                Console.WriteLine("SA: Polling suppler url according to supplier category");
                Console.WriteLine("PA: Polling suppler url according to product category");
                Console.WriteLine("UM: Polling suppler from supplier url");
                Console.WriteLine("UMF: Polling suppler from supplier url by using WebDriver");
            }
            else
            {
                String code = args[0];
                switch (code)
                {
                case "SA":      //Supplier Category to url
                case "PA":      //Product Category to url
                    BusinessLogic.PollingCategoryUrls(System.Configuration.ConfigurationManager.ConnectionStrings["Alibaba"].ConnectionString, code);
                    break;

                case "PC":
                    BusinessLogic.PollingProductCategory(System.Configuration.ConfigurationManager.ConnectionStrings["Alibaba"].ConnectionString, code);
                    break;

                case "S":
                    BusinessLogic.PollingSuppliers(System.Configuration.ConfigurationManager.ConnectionStrings["Alibaba"].ConnectionString);
                    break;

                case "U":
                    BusinessLogic.PollingSuppliersFromUrl(System.Configuration.ConfigurationManager.ConnectionStrings["Alibaba"].ConnectionString);
                    break;

                case "MU":
                    BusinessLogic.PollingSuppliersMetadataFromUrl(System.Configuration.ConfigurationManager.ConnectionStrings["Alibaba"].ConnectionString);
                    break;

                case "UM":      //by using webClient
                    BusinessLogic.PollingSuppliersFromUrlMetadata(System.Configuration.ConfigurationManager.ConnectionStrings["Alibaba"].ConnectionString, false);
                    break;

                case "UMF":     //By using webdriver
                    BusinessLogic.PollingSuppliersFromUrlMetadata(System.Configuration.ConfigurationManager.ConnectionStrings["Alibaba"].ConnectionString, true);
                    break;

                default:
                    //BusinessLogic.PollingSuppliers(System.Configuration.ConfigurationManager.ConnectionStrings["Alibaba"].ConnectionString);
                    //BusinessLogic.PollingSuppliersFromUrl(System.Configuration.ConfigurationManager.ConnectionStrings["Alibaba"].ConnectionString);
                    break;
                }
            }
            stopWatch.Stop();
            TimeSpan ts = stopWatch.Elapsed;
            Console.WriteLine(String.Format("{0}{1}{0}", new String('=', 5), DateTime.Now));
            Console.WriteLine(String.Format("Elapsed: {0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10));
            Console.WriteLine("THE END");
            //Console.ReadLine();
        }
示例#45
0
    protected void cmbProdAdd_SelectedIndexChanged(object sender, EventArgs e)
    {
        try
        {
            sDataSource = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString();
            BusinessLogic bl       = new BusinessLogic(sDataSource);
            DataSet       ds       = new DataSet();
            DataSet       roleDs   = new DataSet();
            string        itemCode = string.Empty;
            DataSet       checkDs;

            if (cmbProdAdd.SelectedItem != null)
            {
                itemCode = cmbProdAdd.SelectedItem.Value.Trim();

                DataSet catData = bl.GetProductForId(sDataSource, cmbProdAdd.SelectedItem.Value.Trim());

                if (catData != null)
                {
                    if ((catData.Tables[0].Rows[0]["Model"] != null) && (catData.Tables[0].Rows[0]["Model"].ToString() != ""))
                    {
                        if (cmbModel.Items.FindByValue(catData.Tables[0].Rows[0]["Model"].ToString().Trim()) != null)
                        {
                            cmbModel.ClearSelection();
                            if (!cmbModel.Items.FindByValue(catData.Tables[0].Rows[0]["Model"].ToString().Trim()).Selected)
                            {
                                cmbModel.Items.FindByValue(catData.Tables[0].Rows[0]["Model"].ToString().Trim()).Selected = true;
                            }
                        }
                    }

                    if ((catData.Tables[0].Rows[0]["ProductDesc"] != null) && (catData.Tables[0].Rows[0]["ProductDesc"].ToString() != ""))
                    {
                        if (cmbBrand.Items.FindByValue(catData.Tables[0].Rows[0]["ProductDesc"].ToString().Trim()) != null)
                        {
                            cmbBrand.ClearSelection();
                            if (!cmbBrand.Items.FindByValue(catData.Tables[0].Rows[0]["ProductDesc"].ToString().Trim()).Selected)
                            {
                                cmbBrand.Items.FindByValue(catData.Tables[0].Rows[0]["ProductDesc"].ToString().Trim()).Selected = true;
                            }
                        }
                    }

                    if ((catData.Tables[0].Rows[0]["ProductName"] != null) && (catData.Tables[0].Rows[0]["ProductName"].ToString() != ""))
                    {
                        if (cmbProdName.Items.FindByValue(catData.Tables[0].Rows[0]["ProductName"].ToString().Trim()) != null)
                        {
                            cmbProdName.ClearSelection();
                            if (!cmbProdName.Items.FindByValue(catData.Tables[0].Rows[0]["ProductName"].ToString().Trim()).Selected)
                            {
                                cmbProdName.Items.FindByValue(catData.Tables[0].Rows[0]["ProductName"].ToString().Trim()).Selected = true;
                            }
                        }
                    }
                }
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)]//Specify return format.
        public HttpResponseMessage GetAppliancesStatusARDUNO(string Email)
        {
            string _outMessage = "";

            try
            {
                BusinessLogic objBusinessLogic          = new BusinessLogic();
                IEnumerable <ApplianceMaster> lstResult = objBusinessLogic.GetAllAppliances(_connStr, Email, 0, out _outMessage);

                AppStatusARDUNO _appIOT = new AppStatusARDUNO();
                int             _index  = 0;
                foreach (ApplianceMaster app in lstResult)
                {
                    if (_index == 0)
                    {
                        _appIOT.A1 = app.StatusOnOff;
                    }
                    if (_index == 1)
                    {
                        _appIOT.A2 = app.StatusOnOff;
                    }
                    if (_index == 2)
                    {
                        _appIOT.A3 = app.StatusOnOff;
                    }
                    if (_index == 3)
                    {
                        _appIOT.A4 = app.StatusOnOff;
                    }
                    if (_index == 4)
                    {
                        _appIOT.A5 = app.StatusOnOff;
                    }
                    if (_index == 5)
                    {
                        _appIOT.A6 = app.StatusOnOff;
                    }
                    if (_index == 6)
                    {
                        _appIOT.A7 = app.StatusOnOff;
                    }
                    if (_index == 7)
                    {
                        _appIOT.A8 = app.StatusOnOff;
                    }
                    if (_index == 8)
                    {
                        _appIOT.A9 = app.StatusOnOff;
                    }
                    if (_index == 9)
                    {
                        _appIOT.A10 = app.StatusOnOff;
                    }
                    if (_index == 10)
                    {
                        _appIOT.A11 = app.StatusOnOff;
                    }
                    if (_index == 11)
                    {
                        _appIOT.A12 = app.StatusOnOff;
                    }
                    if (_index == 12)
                    {
                        _appIOT.A13 = app.StatusOnOff;
                    }
                    _index++;
                }


                var    serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                string jSON       = serializer.Serialize(_appIOT);

                var response = this.Request.CreateResponse(HttpStatusCode.OK);
                response.Content = new StringContent(jSON, Encoding.UTF8, "application/json");
                return(response);
            }
            catch
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
                // return "ERROR";
            }
        }
示例#47
0
        public static bool query(out List <List <string> > toRetBase, out string toRetName, out string result, string toQuery)
        {
            bool isQueried = false;

            result = "invalid command";

            toRetName = CurrentBaseName;
            toRetBase = null;


            toQuery = toQuery.Trim();
            // \e\ пустая строка
            if (toQuery == "")
            {
                result = "empty string";
                return(false);
            }

            // работа с оператором 'select'
            else if (toQuery.StartsWith("SELECT "))
            {
                // \e\ еще один оператор 'select' внутри
                if (toQuery.LastIndexOf("SELECT") != 0)
                {
                    result = "'select' into another 'select' operator";
                    return(false);
                }
                toQuery = toQuery.Substring(7);

                // есть условный оператор 'where'
                if (toQuery.Contains(" WHERE "))
                {
                    // \e\ в строке несколько операторов 'where'
                    if (toQuery.IndexOf(" WHERE ") != toQuery.LastIndexOf(" WHERE "))
                    {
                        result = "multiple operators 'where'";
                        return(false);
                    }

                    string condition = toQuery.Substring(toQuery.IndexOf("WHERE") + 5).Trim();
                    toQuery = toQuery.Substring(0, toQuery.IndexOf("WHERE")).Trim();

                    if (toQuery == "country")
                    {
                        if (condition.StartsWith("name IS "))
                        {
                            toRetBase = BusinessLogic.SelectCountriesWithName(condition.Substring(8).Trim(), 0);
                        }
                        else if (condition.StartsWith("name BEGIN WITH "))
                        {
                            toRetBase = BusinessLogic.SelectCountriesWithName(condition.Substring(16).Trim(), 1);
                        }
                        else if (condition.StartsWith("name END WITH "))
                        {
                            toRetBase = BusinessLogic.SelectCountriesWithName(condition.Substring(14).Trim(), 2);
                        }


                        // \e\ неправильное условие
                        else
                        {
                            result = "wrong condition for 'where'";
                            return(false);
                        }
                        result    = "countries selected";
                        isQueried = true;
                    }
                    else if (toQuery == "product")
                    {
                        if (condition.StartsWith("name IS "))
                        {
                            // \e\ несколько несовместимых условий
                            if (condition.IndexOf("IS") != condition.LastIndexOf("IS"))
                            {
                                result = "cant take multiple conditions in 'where'";
                                return(false);
                            }
                            toRetBase = BusinessLogic.SelectProductsWithName(condition.Substring(8).Trim(), 2);
                        }
                        else if (condition.StartsWith("name BEGIN WITH "))
                        {
                            // \e\ несколько несовместимых условий
                            if (condition.IndexOf("WITH") != condition.LastIndexOf("WITH"))
                            {
                                result = "cant take multiple conditions in 'where'";
                                return(false);
                            }
                            toRetBase = BusinessLogic.SelectProductsWithName(condition.Substring(16).Trim(), 1);
                        }
                        else if (condition.StartsWith("name END WITH "))
                        {
                            // \e\ несколько несовместимых условий
                            if (condition.IndexOf("WITH") != condition.LastIndexOf("WITH"))
                            {
                                result = "cant take multiple conditions in 'where'";
                                return(false);
                            }
                            toRetBase = BusinessLogic.SelectProductsWithName(condition.Substring(14).Trim(), 2);
                        }

                        // \e\ неправильное условие
                        else
                        {
                            result = "wrong condition for 'where'";
                            return(false);
                        }
                        result    = "products selected";
                        isQueried = true;
                    }
                    else if (toQuery == "export")
                    {
                        if (condition.StartsWith("country IS "))
                        {
                            toRetBase = BusinessLogic.SelectExportsWithCountry(condition.Substring(11).Trim(), 0);
                        }
                        else if (condition.StartsWith("country BEGIN WITH "))
                        {
                            toRetBase = BusinessLogic.SelectExportsWithCountry(condition.Substring(19).Trim(), 1);
                        }
                        else if (condition.StartsWith("country END WITH "))
                        {
                            toRetBase = BusinessLogic.SelectExportsWithCountry(condition.Substring(17).Trim(), 2);
                        }

                        else if (condition.StartsWith("product IS "))
                        {
                            toRetBase = BusinessLogic.SelectExportsWithProduct(condition.Substring(11).Trim(), 0, out string total);
                            result    = $"total amount of product '{condition.Substring(11).Trim()}' is {total}";
                        }
                        else if (condition.StartsWith("product BEGIN WITH "))
                        {
                            toRetBase = BusinessLogic.SelectExportsWithProduct(condition.Substring(19).Trim(), 1, out string total);
                        }
                        else if (condition.StartsWith("product END WITH "))
                        {
                            toRetBase = BusinessLogic.SelectExportsWithProduct(condition.Substring(17).Trim(), 2, out string total);
                        }

                        else if (condition.StartsWith("positions count == "))
                        {
                            condition = condition.Substring(19).Trim();
                            if (int.TryParse(condition, out int num))
                            {
                                toRetBase = BusinessLogic.SelectExportsWithCount(num, 0);
                            }
                            // \e\ сравнение не с числом
                            else
                            {
                                result = "trying to compare amount with non-number";
                                return(false);
                            }
                        }
                        else if (condition.StartsWith("positions count >= "))
                        {
                            condition = condition.Substring(19).Trim();
                            if (int.TryParse(condition, out int num))
                            {
                                toRetBase = BusinessLogic.SelectExportsWithCount(num, 1);
                            }
                            // \e\ сравнение не с числом
                            else
                            {
                                result = "trying to compare amount with non-number";
                                return(false);
                            }
                        }
                        else if (condition.StartsWith("positions count <= "))
                        {
                            condition = condition.Substring(19).Trim();
                            if (int.TryParse(condition, out int num))
                            {
                                toRetBase = BusinessLogic.SelectExportsWithCount(num, 2);
                            }
                            // \e\ сравнение не с числом
                            else
                            {
                                result = "trying to compare amount with non-number";
                                return(false);
                            }
                        }
                        else if (condition.StartsWith("positions count > "))
                        {
                            condition = condition.Substring(18).Trim();
                            if (int.TryParse(condition, out int num))
                            {
                                toRetBase = BusinessLogic.SelectExportsWithCount(num, 3);
                            }
                            // \e\ сравнение не с числом
                            else
                            {
                                result = "trying to compare amount with non-number";
                                return(false);
                            }
                        }
                        else if (condition.StartsWith("positions count < "))
                        {
                            condition = condition.Substring(18).Trim();
                            if (int.TryParse(condition, out int num))
                            {
                                toRetBase = BusinessLogic.SelectExportsWithCount(num, 4);
                            }
                            // \e\ сравнение не с числом
                            else
                            {
                                result = "trying to compare amount with non-number";
                                return(false);
                            }
                        }
                        else if (condition.StartsWith("positions count != "))
                        {
                            condition = condition.Substring(19).Trim();
                            if (int.TryParse(condition, out int num))
                            {
                                toRetBase = BusinessLogic.SelectExportsWithCount(num, 5);
                            }
                            // \e\ сравнение не с числом
                            else
                            {
                                result = "trying to compare amount with non-number";
                                return(false);
                            }
                        }

                        else if (condition.StartsWith("product amount == "))
                        {
                            condition = condition.Substring(18).Trim();
                            if (int.TryParse(condition, out int num))
                            {
                                toRetBase = BusinessLogic.SelectExportsWithAmount(num, 0);
                            }
                            // \e\ сравнение не с числом
                            else
                            {
                                result = "trying to compare amount with non-number";
                                return(false);
                            }
                        }
                        else if (condition.StartsWith("product amount >= "))
                        {
                            condition = condition.Substring(18).Trim();
                            if (int.TryParse(condition, out int num))
                            {
                                toRetBase = BusinessLogic.SelectExportsWithAmount(num, 1);
                            }
                            // \e\ сравнение не с числом
                            else
                            {
                                result = "trying to compare amount with non-number";
                                return(false);
                            }
                        }
                        else if (condition.StartsWith("product amount <= "))
                        {
                            condition = condition.Substring(18).Trim();
                            if (int.TryParse(condition, out int num))
                            {
                                toRetBase = BusinessLogic.SelectExportsWithAmount(num, 2);
                            }
                            // \e\ сравнение не с числом
                            else
                            {
                                result = "trying to compare amount with non-number";
                                return(false);
                            }
                        }
                        else if (condition.StartsWith("product amount > "))
                        {
                            condition = condition.Substring(17).Trim();
                            if (int.TryParse(condition, out int num))
                            {
                                toRetBase = BusinessLogic.SelectExportsWithAmount(num, 3);
                            }
                            // \e\ сравнение не с числом
                            else
                            {
                                result = "trying to compare amount with non-number";
                                return(false);
                            }
                        }
                        else if (condition.StartsWith("product amount < "))
                        {
                            condition = condition.Substring(17).Trim();
                            if (int.TryParse(condition, out int num))
                            {
                                toRetBase = BusinessLogic.SelectExportsWithAmount(num, 4);
                            }
                            // \e\ сравнение не с числом
                            else
                            {
                                result = "trying to compare amount with non-number";
                                return(false);
                            }
                        }
                        else if (condition.StartsWith("product amount != "))
                        {
                            condition = condition.Substring(18).Trim();
                            if (int.TryParse(condition, out int num))
                            {
                                toRetBase = BusinessLogic.SelectExportsWithAmount(num, 5);
                            }
                            // \e\ сравнение не с числом
                            else
                            {
                                result = "trying to compare amount with non-number";
                                return(false);
                            }
                        }

                        // \e\ неправильное условие
                        else
                        {
                            result = "wrong condition for 'where'";
                            return(false);
                        }
                        if (!result.StartsWith("total"))
                        {
                            result = "export selected";
                        }
                        isQueried = true;
                    }
                    else if (toQuery == "position")
                    {
                        if (condition.StartsWith("name IS "))
                        {
                            toRetBase = BusinessLogic.SelectPositionsWithName(condition.Substring(8).Trim(), 0);
                        }
                        else if (condition.StartsWith("name BEGIN WITH "))
                        {
                            toRetBase = BusinessLogic.SelectPositionsWithName(condition.Substring(16).Trim(), 1);
                        }
                        else if (condition.StartsWith("name END WITH "))
                        {
                            toRetBase = BusinessLogic.SelectPositionsWithName(condition.Substring(14).Trim(), 2);
                        }


                        else if (condition.StartsWith("amount == "))
                        {
                            condition = condition.Substring(10).Trim();
                            if (int.TryParse(condition, out int num))
                            {
                                toRetBase = BusinessLogic.SelectPositionsWithAmount(num, 0);
                            }
                            // \e\ сравнение не с числом
                            else
                            {
                                result = "trying to compare amount with non-number";
                                return(false);
                            }
                        }
                        else if (condition.StartsWith("amount >= "))
                        {
                            condition = condition.Substring(10).Trim();
                            if (int.TryParse(condition, out int num))
                            {
                                toRetBase = BusinessLogic.SelectPositionsWithAmount(num, 1);
                            }
                            // \e\ сравнение не с числом
                            else
                            {
                                result = "trying to compare amount with non-number";
                                return(false);
                            }
                        }
                        else if (condition.StartsWith("amount <= "))
                        {
                            condition = condition.Substring(10).Trim();
                            if (int.TryParse(condition, out int num))
                            {
                                toRetBase = BusinessLogic.SelectPositionsWithAmount(num, 2);
                            }
                            // \e\ сравнение не с числом
                            else
                            {
                                result = "trying to compare amount with non-number";
                                return(false);
                            }
                        }
                        else if (condition.StartsWith("amount > "))
                        {
                            condition = condition.Substring(9).Trim();
                            if (int.TryParse(condition, out int num))
                            {
                                toRetBase = BusinessLogic.SelectPositionsWithAmount(num, 3);
                            }
                            // \e\ сравнение не с числом
                            else
                            {
                                result = "trying to compare amount with non-number";
                                return(false);
                            }
                        }
                        else if (condition.StartsWith("amount < "))
                        {
                            condition = condition.Substring(9).Trim();
                            if (int.TryParse(condition, out int num))
                            {
                                toRetBase = BusinessLogic.SelectPositionsWithAmount(num, 4);
                            }
                            // \e\ сравнение не с числом
                            else
                            {
                                result = "trying to compare amount with non-number";
                                return(false);
                            }
                        }
                        else if (condition.StartsWith("amount != "))
                        {
                            condition = condition.Substring(10).Trim();
                            if (int.TryParse(condition, out int num))
                            {
                                toRetBase = BusinessLogic.SelectPositionsWithAmount(num, 5);
                            }
                            // \e\ сравнение не с числом
                            else
                            {
                                result = "trying to compare amount with non-number";
                                return(false);
                            }
                        }


                        // \e\ неправильное условие
                        else
                        {
                            result = "wrong condition for 'where'";
                            return(false);
                        }
                        result    = "position selected";
                        isQueried = true;
                    }
                }

                // нет условного оператора 'where'
                else
                {
                    toQuery = toQuery.Trim();
                    if (toQuery == "country")
                    {
                        toRetBase = BusinessLogic.SelectCountries();
                        result    = "countries selected";
                        isQueried = true;
                    }
                    else if (toQuery == "product")
                    {
                        toRetBase = BusinessLogic.SelectProducts();
                        result    = "products selected";
                        isQueried = true;
                    }
                    else if (toQuery == "export")
                    {
                        toRetBase = BusinessLogic.SelectExports();
                        result    = "export selected";
                        isQueried = true;
                    }
                    else if (toQuery == "position")
                    {
                        toRetBase = BusinessLogic.SelectPositions();
                        result    = "position selected";
                        isQueried = true;
                    }

                    // \e\ операнд оператора 'select' некорректный
                    else
                    {
                        result = "wrong parameter into 'select'";
                        return(false);
                    }
                }
            }

            else if (toQuery.StartsWith("INSERT "))
            {
                // \e\ еще один оператор 'select' внутри
                if (toQuery.LastIndexOf("INSERT") != 0)
                {
                    result = "'insert' into another 'insert' operator";
                    return(false);
                }
                toQuery = toQuery.Substring(7).Trim();

                if (toQuery.StartsWith("country "))
                {
                    toQuery = toQuery.Substring(8).Trim();
                    // \e\ новое значение не в фигурных скобках
                    if (toQuery.LastIndexOf('{') != 0 || toQuery.IndexOf('}') != (toQuery.Count() - 1))
                    {
                        result = "cant recognize new country name inside '{}'";
                        return(false);
                    }

                    toQuery = toQuery.Trim('{', '}', ' ');

                    // \e\ новое значение - пустая строка
                    if (toQuery == "")
                    {
                        result = "new value can't be empty";
                        return(false);
                    }

                    // \e\ уже есть такая страна
                    if (!BusinessLogic.InsertCountry(toQuery))
                    {
                        result = "country with this name already exist";
                        return(false);
                    }

                    toRetBase = BusinessLogic.SelectCountries();
                    result    = "country added successfully";
                    isQueried = true;
                }
                else if (toQuery.StartsWith("product "))
                {
                    toQuery = toQuery.Substring(8).Trim();
                    // \e\ новое значение не в фигурных скобках
                    if (toQuery.LastIndexOf('{') != 0 || toQuery.IndexOf('}') != (toQuery.Count() - 1))
                    {
                        result = "cant recognize new product name inside '{}'";
                        return(false);
                    }

                    toQuery = toQuery.Trim('{', '}', ' ');

                    // \e\ новое значение - пустая строка
                    if (toQuery == "")
                    {
                        result = "new value can't be empty";
                        return(false);
                    }

                    // \e\ уже есть такая страна
                    if (!BusinessLogic.InsertProduct(toQuery))
                    {
                        result = "product with this name already exist";
                        return(false);
                    }

                    toRetBase = BusinessLogic.SelectProducts();
                    result    = "product added successfully";
                    isQueried = true;
                }
                else if (toQuery.StartsWith("export "))
                {
                    toQuery = toQuery.Substring(7).Trim();
                    // \e\ новое значение не в фигурных скобках
                    if (toQuery.LastIndexOf('{') != 0 || toQuery.IndexOf('}') != (toQuery.Count() - 1))
                    {
                        result = "cant recognize new export values inside '{}'";
                        return(false);
                    }

                    toQuery = toQuery.Trim('{', '}', ' ');

                    // \e\ нет такой страны или экспорт туда уже есть
                    if (!BusinessLogic.InsertExport(toQuery))
                    {
                        result = "export to such country already exist or no such country";
                        return(false);
                    }

                    result    = "export added successfully";
                    toRetBase = BusinessLogic.SelectExports();
                    isQueried = true;
                }
                else if (toQuery.StartsWith("position "))
                {
                    toQuery = toQuery.Substring(9).Trim();
                    // \e\ новое значение не в фигурных скобках
                    if (toQuery.LastIndexOf('{') != 0 || toQuery.IndexOf('}') != (toQuery.Count() - 1))
                    {
                        result = "cant recognize new product name inside '{}'";
                        return(false);
                    }

                    toQuery = toQuery.Trim('{', '}', ' ');

                    // \e\ больше двух параметров или один из них пустой
                    if (toQuery.IndexOf(',') != toQuery.LastIndexOf(',') || toQuery.IndexOf(',') == 0 || toQuery.IndexOf(',') == toQuery.Count())
                    {
                        result = "wrong parameters";
                        return(false);
                    }
                    if (int.TryParse(toQuery.Substring(toQuery.IndexOf(',') + 2).Trim(), out int amount))
                    {
                        // \e\ нет такого товара
                        if (!BusinessLogic.InsertPosition(toQuery.Substring(0, toQuery.IndexOf(',')).Trim(), amount))
                        {
                            result = "no such product";
                            return(false);
                        }
                    }
                    else
                    {
                        result = "amount is non-numeric";
                        return(false);
                    }

                    result    = "position added successfully";
                    toRetBase = BusinessLogic.SelectPositions();
                    isQueried = true;
                }
            }

            else if (toQuery.StartsWith("SET "))
            {
                // \e\ еще один оператор 'set' внутри
                if (toQuery.LastIndexOf("SET") != 0)
                {
                    result = "'set' into another 'set' operator";
                    return(false);
                }
                toQuery = toQuery.Substring(4).Trim();

                if (toQuery.StartsWith("country "))
                {
                    toQuery = toQuery.Substring(8).Trim();
                    // \e\ нет индекса строки для изменения
                    if (!toQuery.StartsWith("[") || toQuery.IndexOf('[') != toQuery.LastIndexOf('[') || toQuery.LastIndexOf(']') != toQuery.IndexOf(']') || toQuery.IndexOf(']') == -1)
                    {
                        result = "no id of row to change";
                        return(false);
                    }

                    int id;
                    // \e\ внутри [] не индекс
                    if (!int.TryParse(toQuery.Substring(1, toQuery.IndexOf(']') - 1).Trim(), out id))
                    {
                        result = "there is no number inside '[]'";
                        return(false);
                    }

                    toQuery = toQuery.Substring(toQuery.IndexOf(']') + 1).Trim();

                    // \e\ новое значение не в фигурных скобках
                    if (toQuery.LastIndexOf('{') != 0 || toQuery.IndexOf('}') != (toQuery.Count() - 1))
                    {
                        result = "cant recognize new country name inside '{}'";
                        return(false);
                    }

                    toQuery = toQuery.Trim('{', '}', ' ');

                    // \e\ новое значение - пустая строка
                    if (toQuery == "")
                    {
                        result = "new value can't be empty";
                        return(false);
                    }

                    // \e\ уже есть такая страна
                    if (!BusinessLogic.SetCountry(id, toQuery))
                    {
                        result = "no such row or country with this name already exist";
                        return(false);
                    }

                    toRetBase = BusinessLogic.SelectCountries();
                    result    = "country changed successfully";
                    isQueried = true;
                }
                else if (toQuery.StartsWith("product "))
                {
                    toQuery = toQuery.Substring(8).Trim();
                    // \e\ нет индекса строки для изменения
                    if (!toQuery.StartsWith("[") || toQuery.IndexOf('[') != toQuery.LastIndexOf('[') || toQuery.LastIndexOf(']') != toQuery.IndexOf(']') || toQuery.IndexOf(']') == -1)
                    {
                        result = "no id of row to change";
                        return(false);
                    }

                    int id;
                    // \e\ внутри [] не индекс
                    if (!int.TryParse(toQuery.Substring(1, toQuery.IndexOf(']') - 1).Trim(), out id))
                    {
                        result = "there is no number inside '[]'";
                        return(false);
                    }

                    toQuery = toQuery.Substring(toQuery.IndexOf(']') + 1).Trim();

                    // \e\ новое значение не в фигурных скобках
                    if (toQuery.LastIndexOf('{') != 0 || toQuery.IndexOf('}') != (toQuery.Count() - 1))
                    {
                        result = "cant recognize new product name inside '{}'";
                        return(false);
                    }

                    toQuery = toQuery.Trim('{', '}', ' ');

                    // \e\ новое значение - пустая строка
                    if (toQuery == "")
                    {
                        result = "new value can't be empty";
                        return(false);
                    }

                    // \e\ уже есть такой продукт
                    if (!BusinessLogic.SetProduct(id, toQuery))
                    {
                        result = "no such row or product with this name already exist";
                        return(false);
                    }

                    toRetBase = BusinessLogic.SelectProducts();
                    result    = "product changed successfully";
                    isQueried = true;
                }
                else if (toQuery.StartsWith("export "))
                {
                    toQuery = toQuery.Substring(7).Trim();

                    if (toQuery.StartsWith("add position "))
                    {
                        toQuery = toQuery.Substring(13).Trim();
                        // \e\ нет индекса строки для изменения
                        if (!toQuery.StartsWith("[") || toQuery.IndexOf('[') != toQuery.LastIndexOf('[') || toQuery.LastIndexOf(']') != toQuery.IndexOf(']') || toQuery.IndexOf(']') == -1)
                        {
                            result = "no id of row to change";
                            return(false);
                        }

                        int id;
                        // \e\ внутри [] не индекс
                        if (!int.TryParse(toQuery.Substring(1, toQuery.IndexOf(']') - 1).Trim(), out id))
                        {
                            result = "there is no number inside '[]'";
                            return(false);
                        }

                        toQuery = toQuery.Substring(toQuery.IndexOf(']') + 1).Trim();

                        // \e\ новое значение не в фигурных скобках
                        if (toQuery.LastIndexOf('{') != 0 || toQuery.IndexOf('}') != (toQuery.Count() - 1))
                        {
                            result = "cant recognize new amount inside '{}'";
                            return(false);
                        }

                        toQuery = toQuery.Trim('{', '}', ' ');

                        int newId = 0;
                        // \e\ новое значение - не число
                        if (!int.TryParse(toQuery, out newId))
                        {
                            result = "id of position is non-number";
                            return(false);
                        }

                        // \e\ нет нужной строки, нужной позиции или позиция уже назначена другому экспорту
                        if (!BusinessLogic.SetExportNewPosition(id, newId))
                        {
                            result = "no such row or such position or position is at other export";
                            return(false);
                        }
                    }
                    else if (toQuery.StartsWith("remove position "))
                    {
                        toQuery = toQuery.Substring(16).Trim();
                        // \e\ нет индекса строки для изменения
                        if (!toQuery.StartsWith("[") || toQuery.IndexOf('[') != toQuery.LastIndexOf('[') || toQuery.LastIndexOf(']') != toQuery.IndexOf(']') || toQuery.IndexOf(']') == -1)
                        {
                            result = "no id of row to change";
                            return(false);
                        }

                        int id;
                        // \e\ внутри [] не индекс
                        if (!int.TryParse(toQuery.Substring(1, toQuery.IndexOf(']') - 1).Trim(), out id))
                        {
                            result = "there is no number inside '[]'";
                            return(false);
                        }

                        toQuery = toQuery.Substring(toQuery.IndexOf(']') + 1).Trim();

                        // \e\ новое значение не в фигурных скобках
                        if (toQuery.LastIndexOf('{') != 0 || toQuery.IndexOf('}') != (toQuery.Count() - 1))
                        {
                            result = "cant recognize new amount inside '{}'";
                            return(false);
                        }

                        toQuery = toQuery.Trim('{', '}', ' ');

                        int newId = 0;
                        // \e\ новое значение - не число
                        if (!int.TryParse(toQuery, out newId))
                        {
                            result = "id of position is non-number";
                            return(false);
                        }

                        // \e\ нет нужной строки, нужной позиции или позиция уже назначена другому экспорту
                        if (!BusinessLogic.SetExportRemovePosition(id, newId))
                        {
                            result = "no such row or such position at row";
                            return(false);
                        }
                    }
                    else if (toQuery.StartsWith("country "))
                    {
                        toQuery = toQuery.Substring(8).Trim();
                        // \e\ нет индекса строки для изменения
                        if (!toQuery.StartsWith("[") || toQuery.IndexOf('[') != toQuery.LastIndexOf('[') || toQuery.LastIndexOf(']') != toQuery.IndexOf(']') || toQuery.IndexOf(']') == -1)
                        {
                            result = "no id of row to change";
                            return(false);
                        }

                        int id;
                        // \e\ внутри [] не индекс
                        if (!int.TryParse(toQuery.Substring(1, toQuery.IndexOf(']') - 1).Trim(), out id))
                        {
                            result = "there is no number inside '[]'";
                            return(false);
                        }

                        toQuery = toQuery.Substring(toQuery.IndexOf(']') + 1).Trim();

                        // \e\ новое значение не в фигурных скобках
                        if (toQuery.LastIndexOf('{') != 0 || toQuery.IndexOf('}') != (toQuery.Count() - 1))
                        {
                            result = "cant recognize new name inside '{}'";
                            return(false);
                        }

                        toQuery = toQuery.Trim('{', '}', ' ');

                        // \e\ новое значение - пустая строка
                        if (toQuery == "")
                        {
                            result = "new name can't be empty";
                            return(false);
                        }

                        // \e\ нет нужной строки или такой страны
                        if (!BusinessLogic.SetExportCountry(id, toQuery))
                        {
                            result = "no such row or country";
                            return(false);
                        }
                    }

                    // \e\ неправильное уточнение что именно в экспорте менять
                    else
                    {
                        result = "wrong command";
                        return(false);
                    }


                    toRetBase = BusinessLogic.SelectExports();
                    result    = "exports changed successfully";
                    isQueried = true;
                }
                else if (toQuery.StartsWith("position "))
                {
                    toQuery = toQuery.Substring(9).Trim();

                    if (toQuery.StartsWith("amount "))
                    {
                        toQuery = toQuery.Substring(7).Trim();
                        // \e\ нет индекса строки для изменения
                        if (!toQuery.StartsWith("[") || toQuery.IndexOf('[') != toQuery.LastIndexOf('[') || toQuery.LastIndexOf(']') != toQuery.IndexOf(']') || toQuery.IndexOf(']') == -1)
                        {
                            result = "no id of row to change";
                            return(false);
                        }

                        int id;
                        // \e\ внутри [] не индекс
                        if (!int.TryParse(toQuery.Substring(1, toQuery.IndexOf(']') - 1).Trim(), out id))
                        {
                            result = "there is no number inside '[]'";
                            return(false);
                        }

                        toQuery = toQuery.Substring(toQuery.IndexOf(']') + 1).Trim();

                        // \e\ новое значение не в фигурных скобках
                        if (toQuery.LastIndexOf('{') != 0 || toQuery.IndexOf('}') != (toQuery.Count() - 1))
                        {
                            result = "cant recognize new amount inside '{}'";
                            return(false);
                        }

                        toQuery = toQuery.Trim('{', '}', ' ');

                        int newAmount = 0;
                        // \e\ новое значение - не число
                        if (!int.TryParse(toQuery, out newAmount))
                        {
                            result = "new value can't be empty";
                            return(false);
                        }

                        // \e\ нет нужной строки
                        if (!BusinessLogic.SetPositionAmount(id, newAmount))
                        {
                            result = "no such row";
                            return(false);
                        }
                    }
                    else if (toQuery.StartsWith("name "))
                    {
                        toQuery = toQuery.Substring(5).Trim();
                        // \e\ нет индекса строки для изменения
                        if (!toQuery.StartsWith("[") || toQuery.IndexOf('[') != toQuery.LastIndexOf('[') || toQuery.LastIndexOf(']') != toQuery.IndexOf(']') || toQuery.IndexOf(']') == -1)
                        {
                            result = "no id of row to change";
                            return(false);
                        }

                        int id;
                        // \e\ внутри [] не индекс
                        if (!int.TryParse(toQuery.Substring(1, toQuery.IndexOf(']') - 1).Trim(), out id))
                        {
                            result = "there is no number inside '[]'";
                            return(false);
                        }

                        toQuery = toQuery.Substring(toQuery.IndexOf(']') + 1).Trim();

                        // \e\ новое значение не в фигурных скобках
                        if (toQuery.LastIndexOf('{') != 0 || toQuery.IndexOf('}') != (toQuery.Count() - 1))
                        {
                            result = "cant recognize new name inside '{}'";
                            return(false);
                        }

                        toQuery = toQuery.Trim('{', '}', ' ');

                        // \e\ новое значение - пустая строка
                        if (toQuery == "")
                        {
                            result = "new name can't be empty";
                            return(false);
                        }

                        // \e\ нет нужной строки или такого продукта
                        if (!BusinessLogic.SetPositionName(id, toQuery))
                        {
                            result = "no such row or product";
                            return(false);
                        }
                    }

                    // \e\ неправильное уточнение что именно в позиции менять
                    else
                    {
                        result = "wrong command";
                        return(false);
                    }


                    toRetBase = BusinessLogic.SelectPositions();
                    result    = "position changed successfully";
                    isQueried = true;
                }
            }

            else if (toQuery.StartsWith("DELETE "))
            {
                // \e\ еще один оператор 'delete' внутри
                if (toQuery.LastIndexOf("DELETE") != 0)
                {
                    result = "'delete' into another 'delete' operator";
                    return(false);
                }
                toQuery = toQuery.Substring(7).Trim();

                if (toQuery.StartsWith("country "))
                {
                    toQuery = toQuery.Substring(8).Trim();
                    // \e\ нет индекса строки для удаления
                    if (!toQuery.StartsWith("[") || toQuery.IndexOf('[') != toQuery.LastIndexOf('[') || toQuery.LastIndexOf(']') != toQuery.IndexOf(']') || toQuery.IndexOf(']') == -1)
                    {
                        result = "no id of row to delete";
                        return(false);
                    }

                    int id;
                    // \e\ внутри [] не индекс
                    if (!int.TryParse(toQuery.Substring(1, toQuery.IndexOf(']') - 1).Trim(), out id))
                    {
                        result = "there is no number inside '[]'";
                        return(false);
                    }

                    toQuery = toQuery.Substring(toQuery.IndexOf(']') + 1).Trim();

                    // \e\ нельзя удалить страну
                    if (!BusinessLogic.DeleteCountry(id, out string res))
                    {
                        result = res;
                        return(false);
                    }

                    toRetBase = BusinessLogic.SelectCountries();
                    result    = "country deleted successfully";
                    isQueried = true;
                }
                else if (toQuery.StartsWith("product "))
                {
                    toQuery = toQuery.Substring(8).Trim();
                    // \e\ нет индекса строки для удаления
                    if (!toQuery.StartsWith("[") || toQuery.IndexOf('[') != toQuery.LastIndexOf('[') || toQuery.LastIndexOf(']') != toQuery.IndexOf(']') || toQuery.IndexOf(']') == -1)
                    {
                        result = "no id of row to delete";
                        return(false);
                    }

                    int id;
                    // \e\ внутри [] не индекс
                    if (!int.TryParse(toQuery.Substring(1, toQuery.IndexOf(']') - 1).Trim(), out id))
                    {
                        result = "there is no number inside '[]'";
                        return(false);
                    }

                    toQuery = toQuery.Substring(toQuery.IndexOf(']') + 1).Trim();

                    // \e\ нельзя удалить продукт
                    if (!BusinessLogic.DeleteProduct(id, out string res))
                    {
                        result = res;
                        return(false);
                    }

                    toRetBase = BusinessLogic.SelectProducts();
                    result    = "product deleted successfully";
                    isQueried = true;
                }
                else if (toQuery.StartsWith("export "))
                {
                    toQuery = toQuery.Substring(7).Trim();
                    // \e\ нет индекса строки для удаления
                    if (!toQuery.StartsWith("[") || toQuery.IndexOf('[') != toQuery.LastIndexOf('[') || toQuery.LastIndexOf(']') != toQuery.IndexOf(']') || toQuery.IndexOf(']') == -1)
                    {
                        result = "no id of row to delete";
                        return(false);
                    }

                    int id;
                    // \e\ внутри [] не индекс
                    if (!int.TryParse(toQuery.Substring(1, toQuery.IndexOf(']') - 1).Trim(), out id))
                    {
                        result = "there is no number inside '[]'";
                        return(false);
                    }

                    toQuery = toQuery.Substring(toQuery.IndexOf(']') + 1).Trim();

                    // \e\ нельзя удалить экспорт
                    if (!BusinessLogic.DeleteExport(id))
                    {
                        result = "there is no such row";
                        return(false);
                    }

                    toRetBase = BusinessLogic.SelectExports();
                    result    = "export deleted successfully";
                    isQueried = true;
                }
                else if (toQuery.StartsWith("position "))
                {
                    toQuery = toQuery.Substring(9).Trim();
                    // \e\ нет индекса строки для удаления
                    if (!toQuery.StartsWith("[") || toQuery.IndexOf('[') != toQuery.LastIndexOf('[') || toQuery.LastIndexOf(']') != toQuery.IndexOf(']') || toQuery.IndexOf(']') == -1)
                    {
                        result = "no id of row to delete";
                        return(false);
                    }

                    int id;
                    // \e\ внутри [] не индекс
                    if (!int.TryParse(toQuery.Substring(1, toQuery.IndexOf(']') - 1).Trim(), out id))
                    {
                        result = "there is no number inside '[]'";
                        return(false);
                    }

                    toQuery = toQuery.Substring(toQuery.IndexOf(']') + 1).Trim();

                    // \e\ нельзя удалить позицию
                    if (!BusinessLogic.DeletePosition(id, out string res))
                    {
                        result = res;
                        return(false);
                    }

                    toRetBase = BusinessLogic.SelectPositions();
                    result    = "position deleted successfully";
                    isQueried = true;
                }
            }

            return(isQueried);
        }
示例#48
0
 /// <summary>
 /// Launches programs
 /// </summary>
 static void Main()
 {
     BusinessLogic businessLogic = new BusinessLogic();
 }
示例#49
0
        private async void btnSetTPIN_Clicked(object sender, System.EventArgs e)
        {
            try
            {
                LoginPin    = txtLoginPin.Text;
                ConfirmTPin = txtConfirmTPin.Text;
                TPin        = txtTPin.Text;

                if (BusinessLogic.IsConnectionOK() == true)
                {
                    if (GlobalStaticFields.TPINToSet)
                    {
                        if (!string.IsNullOrEmpty(TPin) && !string.IsNullOrEmpty(ConfirmTPin) && !string.IsNullOrEmpty(LoginPin))
                        {
                            if (TPin != ConfirmTPin)
                            {
                                MessageDialog.Show("OOPS", "Sorry TPIN and Confirm TPIN do not match. Kindly verify and try again", PopUps.DialogType.Error, "OK", null);
                                return;
                            }
                            var pd = await ProgressDialog.Show("Sending Request. Please Wait...");

                            var tpin     = _crypto.Encrypt(TPin);
                            var password = _crypto.Encrypt(LoginPin);
                            var model    = new TPinModel()
                            {
                                TPIN        = tpin,
                                Password    = "",
                                NewPassword = "",
                                UserID      = GlobalStaticFields.Customer.Email
                            };

                            var tpinResponse = await httpService.Post <TPinModel>(model, "", URLConstants.SwitchApiBaseUrl, "Switch/SetTPIN", "UnProfiledLoginPage");

                            await pd.Dismiss();

                            if (tpinResponse.IsSuccessStatusCode)
                            {
                                var success = await tpinResponse.Content.ReadAsStringAsync();

                                if (!string.IsNullOrEmpty(success))
                                {
                                    var resp = JsonConvert.DeserializeObject <string>(success);
                                    if (resp == "1")
                                    {                                    // display success message
                                        MessageDialog.Show("SUCCESS", "Transaction PIN was successfully created.", PopUps.DialogType.Success, "OK", null);
                                        await Navigation.PushAsync(new More.MorePage());

                                        // navigate out
                                    }
                                    else
                                    {
                                        MessageDialog.Show("OOPS", "Sorry We are unable to process your request at the moment. Kindly try again later ", PopUps.DialogType.Error, "OK", null);
                                        return;
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (string.IsNullOrEmpty(TPin))
                            {
                                MessageDialog.Show("OOPS", "Sorry TPIN field is Required", PopUps.DialogType.Error, "OK", null);
                                return;
                            }
                            if (string.IsNullOrEmpty(ConfirmTPin))
                            {
                                MessageDialog.Show("OOPS", "Sorry, Confirm TPIN field is required", PopUps.DialogType.Error, "OK", null);
                                return;
                            }
                            if (string.IsNullOrEmpty(LoginPin))
                            {
                                MessageDialog.Show("OOPS", "Sorry, Login PIN is required to authorize this process", PopUps.DialogType.Error, "OK", null);
                                return;
                            }
                        }
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(LoginPin))
                        {
                            var pd = await ProgressDialog.Show("Sending Request. Please Wait...");

                            var password = _crypto.Encrypt(LoginPin);
                            var model    = new TPinModel()
                            {
                                TPIN        = "",
                                UserID      = GlobalStaticFields.Customer.Email,
                                Password    = "",
                                NewPassword = ""
                            };
                            var tpinResponse = await httpService.Post <TPinModel>(model, "", URLConstants.SwitchApiBaseUrl, "Switch/ResetTPin", "UnProfiledLoginPage");

                            await pd.Dismiss();

                            if (tpinResponse.IsSuccessStatusCode)
                            {
                                var success = await tpinResponse.Content.ReadAsStringAsync();

                                if (!string.IsNullOrEmpty(success))
                                {
                                    var resp = JsonConvert.DeserializeObject <string>(success);
                                    if (resp == "1")
                                    {                                    // display success message
                                        MessageDialog.Show("SUCCESS", "You have successfully disabled your Transaction PIN", PopUps.DialogType.Success, "OK", null);
                                        Application.Current.MainPage = new AnimationNavigationPage(new Dashboard.Dashboard());
                                        // navigate out
                                    }
                                    else
                                    {
                                        // display an unsuccessful message
                                        MessageDialog.Show("OOPS", "Sorry We are unable to process your request at the moment. Kindly try again later", PopUps.DialogType.Error, "OK", null);
                                        return;
                                    }
                                }
                            }
                        }
                        else
                        {
                            MessageDialog.Show("OOPS", "Sorry, login PIN is required to authorize this process", PopUps.DialogType.Error, "OK", null);
                            return;
                        }
                    }
                }
                else
                {
                    MessageDialog.Show("OOPS", "Sorry, It appears you do not have internet connectivity on your phone. Kindly re-connect and try again", DialogType.Error, "OK", null);
                    return;
                }
            }
            catch (Exception ex) { }
        }
示例#50
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                //loadProducts();
                divReport.Visible = false;
                txtStartDate.Text = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).ToShortDateString();
                //txtEndDate.Text = DateTime.Now.ToShortDateString();

                DateTime indianStd = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTime.Now, "India Standard Time");
                string   dtaa      = Convert.ToDateTime(indianStd).ToString("dd/MM/yyyy");
                txtEndDate.Text = dtaa;
            }
            if (!IsPostBack)
            {
                sDataSource = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString();
                DataSet       companyInfo = new DataSet();
                BusinessLogic bl          = new BusinessLogic(sDataSource);
                Session["SalesAddProductbindDs"] = null;
                LoadProducts(this, null);
                loadCategories();
                loadBranch();
                BranchEnable_Disable();
                drpPrd_SelectedIndexChanged(sender, e);



                if (Request.Cookies["Company"] != null)
                {
                    companyInfo = bl.getCompanyInfo(Request.Cookies["Company"].Value);

                    if (companyInfo != null)
                    {
                        if (companyInfo.Tables[0].Rows.Count > 0)
                        {
                            foreach (DataRow dr in companyInfo.Tables[0].Rows)
                            {
                                lblTNGST.Text   = Convert.ToString(dr["TINno"]);
                                lblCompany.Text = Convert.ToString(dr["CompanyName"]);
                                lblPhone.Text   = Convert.ToString(dr["Phone"]);
                                lblGSTno.Text   = Convert.ToString(dr["GSTno"]);

                                lblAddress.Text  = Convert.ToString(dr["Address"]);
                                lblCity.Text     = Convert.ToString(dr["city"]);
                                lblPincode.Text  = Convert.ToString(dr["Pincode"]);
                                lblState.Text    = Convert.ToString(dr["state"]);
                                lblBillDate.Text = DateTime.Now.ToShortDateString();
                            }
                        }
                    }
                }

                ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "$('.chzn-select').chosen(); $('.chzn-select-deselect').chosen({ allow_single_deselect: true });", true);
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
示例#51
0
 public static MediaType MakeNew(BusinessLogic.User u, string Text)
 {
     return MakeNew(u, Text, -1);
 }
示例#52
0
        public ContactController()
        {
            BusinessLogic bl = new BusinessLogic();

            _contact = bl.GetContactBL();
        }
示例#53
0
        public static void ImportDocumentType(XmlNode n, BusinessLogic.User u, bool ImportStructure)
        {
            DocumentType dt = DocumentType.GetByAlias(XmlHelper.GetNodeValue(n.SelectSingleNode("Info/Alias")));
            if (dt == null)
            {
                dt = DocumentType.MakeNew(u, XmlHelper.GetNodeValue(n.SelectSingleNode("Info/Name")));
                dt.Alias = XmlHelper.GetNodeValue(n.SelectSingleNode("Info/Alias"));
            }
            else
            {
                dt.Text = XmlHelper.GetNodeValue(n.SelectSingleNode("Info/Name"));
            }

            // Info
            dt.IconUrl = XmlHelper.GetNodeValue(n.SelectSingleNode("Info/Icon"));
            dt.Thumbnail = XmlHelper.GetNodeValue(n.SelectSingleNode("Info/Thumbnail"));
            dt.Description = XmlHelper.GetNodeValue(n.SelectSingleNode("Info/Description"));

            // Templates	
            ArrayList templates = new ArrayList();
            foreach (XmlNode tem in n.SelectNodes("Info/AllowedTemplates/Template"))
            {
                template.Template t = template.Template.GetByAlias(XmlHelper.GetNodeValue(tem));
                if (t != null)
                    templates.Add(t);
            }

            try
            {
                template.Template[] at = new template.Template[templates.Count];
                for (int i = 0; i < templates.Count; i++)
                    at[i] = (template.Template)templates[i];
                dt.allowedTemplates = at;
            }
            catch (Exception ee)
            {
                BusinessLogic.Log.Add(BusinessLogic.LogTypes.Error, u, dt.Id, "Packager: Error handling allowed templates: " + ee.ToString());
            }

            // Default template
            try
            {
                if (XmlHelper.GetNodeValue(n.SelectSingleNode("Info/DefaultTemplate")) != "")
                    dt.DefaultTemplate = template.Template.GetByAlias(XmlHelper.GetNodeValue(n.SelectSingleNode("Info/DefaultTemplate"))).Id;
            }
            catch (Exception ee)
            {
                BusinessLogic.Log.Add(BusinessLogic.LogTypes.Error, u, dt.Id, "Packager: Error assigning default template: " + ee.ToString());
            }

            // Tabs
            Cms.BusinessLogic.ContentType.TabI[] tabs = dt.getVirtualTabs;
            string tabNames = ";";
            for (int t = 0; t < tabs.Length; t++)
                tabNames += tabs[t].Caption + ";";

            Hashtable ht = new Hashtable();
            foreach (XmlNode t in n.SelectNodes("Tabs/Tab"))
            {
                if (tabNames.IndexOf(";" + XmlHelper.GetNodeValue(t.SelectSingleNode("Caption")) + ";") == -1)
                {
                    ht.Add(int.Parse(XmlHelper.GetNodeValue(t.SelectSingleNode("Id"))),
                        dt.AddVirtualTab(XmlHelper.GetNodeValue(t.SelectSingleNode("Caption"))));
                }
            }


            // Get all tabs in hashtable
            Hashtable tabList = new Hashtable();
            foreach (Cms.BusinessLogic.ContentType.TabI t in dt.getVirtualTabs)
            {
                if (!tabList.ContainsKey(t.Caption))
                    tabList.Add(t.Caption, t.Id);
            }

            // Generic Properties
            datatype.controls.Factory f = new datatype.controls.Factory();
            foreach (XmlNode gp in n.SelectNodes("GenericProperties/GenericProperty"))
            {

                Guid dtId = new Guid(XmlHelper.GetNodeValue(gp.SelectSingleNode("Type")));
                int dfId = 0;
                foreach (datatype.DataTypeDefinition df in datatype.DataTypeDefinition.GetAll())
                    if (df.DataType.Id == dtId)
                    {
                        dfId = df.Id;
                        break;
                    }
                if (dfId != 0)
                {
                    PropertyType pt = dt.getPropertyType(XmlHelper.GetNodeValue(gp.SelectSingleNode("Alias")));
                    if (pt == null)
                    {
                        dt.AddPropertyType(
                            datatype.DataTypeDefinition.GetDataTypeDefinition(dfId),
                            XmlHelper.GetNodeValue(gp.SelectSingleNode("Alias")),
                            XmlHelper.GetNodeValue(gp.SelectSingleNode("Name"))
                            );
                        pt = dt.getPropertyType(XmlHelper.GetNodeValue(gp.SelectSingleNode("Alias")));
                    }
                    else
                    {
                        pt.DataTypeDefinition = datatype.DataTypeDefinition.GetDataTypeDefinition(dfId);
                        pt.Name = XmlHelper.GetNodeValue(gp.SelectSingleNode("Name"));
                    }

                    pt.Mandatory = bool.Parse(XmlHelper.GetNodeValue(gp.SelectSingleNode("Mandatory")));
                    pt.ValidationRegExp = XmlHelper.GetNodeValue(gp.SelectSingleNode("Validation"));
                    pt.Description = XmlHelper.GetNodeValue(gp.SelectSingleNode("Description"));

                    // tab
                    try
                    {
                        if (tabList.ContainsKey(XmlHelper.GetNodeValue(gp.SelectSingleNode("Tab"))))
                            pt.TabId = (int)tabList[XmlHelper.GetNodeValue(gp.SelectSingleNode("Tab"))];
                    }
                    catch (Exception ee)
                    {
                        BusinessLogic.Log.Add(BusinessLogic.LogTypes.Error, u, dt.Id, "Packager: Error assigning property to tab: " + ee.ToString());
                    }
                }
            }

            if (ImportStructure)
            {
                if (dt != null)
                {
                    ArrayList allowed = new ArrayList();
                    foreach (XmlNode structure in n.SelectNodes("Structure/DocumentType"))
                    {
                        DocumentType dtt = DocumentType.GetByAlias(XmlHelper.GetNodeValue(structure));
                        if (dtt != null)
                            allowed.Add(dtt.Id);
                    }
                    int[] adt = new int[allowed.Count];
                    for (int i = 0; i < allowed.Count; i++)
                        adt[i] = (int)allowed[i];
                    dt.AllowedChildContentTypeIDs = adt;
                }
            }

            // clear caching
            foreach(DocumentType.TabI t in dt.getVirtualTabs)
                DocumentType.FlushTabCache(t.Id);

        }
示例#54
0
    protected void btnSettingsSave_Click(object sender, EventArgs e)
    {
        try
        {
            if (Page.IsValid)
            {
                if (Request.Cookies["Company"] != null)
                {
                    sDataSource = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString();
                }
                else
                {
                    Response.Redirect("Login.aspx");
                }

                string        connection = Request.Cookies["Company"].Value;
                string        usernam    = Request.Cookies["LoggedUserName"].Value;
                BusinessLogic bl         = new BusinessLogic(sDataSource);

                if (bl.CheckUserHaveAdd(usernam, "ADM"))
                {
                    btnSettingsSave.Enabled = false;
                    btnSettingsSave.ToolTip = "You are not allowed to make update New ";
                }
                else
                {
                    btnSettingsSave.Enabled = true;
                    btnSettingsSave.ToolTip = "Click to update New ";
                }

                int  settingsId              = 0;
                int  strHolidayCount         = 0;
                int  strPermissionHr         = 0;
                int  strNumPermission        = 0;
                int  strCompOff              = 0;
                int  strWorkdaysWeek         = 0;
                bool boolSupervisorOverwrite = false;

                settingsId              = Convert.ToInt32(SettingsID.Value);
                strHolidayCount         = Convert.ToInt32(txtHolidayCount.Text);
                strPermissionHr         = Convert.ToInt32(txtPermissionHr.Text);
                strNumPermission        = Convert.ToInt32(txtNumPermission.Text);
                strCompOff              = Convert.ToInt32(txtCompOff.Text);
                strWorkdaysWeek         = Convert.ToInt32(txtWorkDays.Text);
                boolSupervisorOverwrite = chkSupervisor.Checked;

                if (strWorkdaysWeek > 7)
                {
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Work days per week is not valid number');", true);
                    //Page.Response.Redirect(HttpContext.Current.Request.Url.ToString(), true);
                }
                else
                {
                    //  BusinessLogic bl = new BusinessLogic(sDataSource);

                    int affectedRows = bl.InsertAdminSettingsInfo(settingsId, strHolidayCount, strPermissionHr, strNumPermission, strCompOff, strWorkdaysWeek, boolSupervisorOverwrite);

                    if (affectedRows == 1)
                    {
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Settings Information Successfully Stored. Please Logout and Login again to refelect the Changes. Thank You.');", true);
                        //Page.Response.Redirect(HttpContext.Current.Request.Url.ToString(), true);
                    }
                }
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
示例#55
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="insertUser"></param>
 public AccountController(BusinessLogic.AppServices.User.Base.IInsert insertUser, BusinessLogic.AppServices.User.Base.IUpdate updateUser)
 {
     this._insertUser = insertUser;
     this._updateUser = updateUser;
     this._regexUtil = new Library.Helpers.RegexUtilities();
 }
 //bind grid
 private void BindGrid()
 {
     GridView1.DataSource = BusinessLogic.GetPurchaseOrders();
     GridView1.DataBind();
 }
 /// <summary>
 /// Creates a new datatypedefinition given its name and the user which creates it.
 /// </summary>
 /// <param name="u">The user who creates the datatypedefinition</param>
 /// <param name="Text">The name of the DataTypeDefinition</param>
 /// <returns></returns>
 public static DataTypeDefinition MakeNew(BusinessLogic.User u, string Text)
 {
     return MakeNew(u, Text, Guid.NewGuid());
 }
        /// <summary>
        /// 取流程变量或者任务变量值,两者的变量名不能重复
        /// </summary>
        /// <param name="userId">用户Id</param>
        /// <param name="workFlowId">流程模版Id</param>
        /// <param name="workTaskId">任务模版Id</param>
        /// <param name="workFlowInstanceId">流程实例Id</param>
        /// <param name="WorkTaskInstanceId">任务实例Id</param>
        /// <param name="varName">变量名称</param>
        /// <returns></returns>
        private string GetWorkTaskVarValue(string userId, string workFlowId, string workTaskId, string workFlowInstanceId, string WorkTaskInstanceId, string varName)
        {
            var varDataBase   = "";
            var varTableName  = "";
            var varFieldName  = "";
            var varInitValue  = "";
            var varAccessType = "";//变量类型
            var varType       = "";
            var varSql        = "";
            var resultValue   = "";
            var tmpVarName    = "";
            var paixu         = "";                                //排序

            tmpVarName = varName.Substring(2, varName.Length - 4); //去掉两头的<%%>
            var dt = new TaskVarManager(this.DBProvider, this.UserInfo).GetTaskVarByName(workFlowId, tmpVarName);

            if (dt != null && dt.Rows.Count > 0)
            {
                varDataBase   = dt.Rows[0][TaskVarTable.FieldDataBaseName].ToString();
                varTableName  = dt.Rows[0][TaskVarTable.FieldTableName].ToString();
                varFieldName  = dt.Rows[0][TaskVarTable.FieldTableField].ToString();
                varInitValue  = dt.Rows[0][TaskVarTable.FieldInitValue].ToString();
                varAccessType = dt.Rows[0][TaskVarTable.FieldAccessType].ToString();
                varType       = dt.Rows[0][TaskVarTable.FieldVarType].ToString();
                paixu         = dt.Rows[0][TaskVarTable.FieldSortField].ToString();
            }
            switch (varAccessType)
            {
            case WorkFlowConst.Access_WorkFlow:
                varSql = string.Format("SELECT " + varFieldName + " FROM " + varTableName + " WHERE WORKFLOWID={0} AND WORKFLOWINSID={1}",
                                       DBProvider.GetParameter("workflowId"),
                                       DBProvider.GetParameter("workFlowInstanceId"));
                if (paixu != "" && paixu != "请选择...")
                {
                    varSql = varSql + " ORDER BY " + paixu + " DESC";
                }

                resultValue = BusinessLogic.ConvertToString(
                    this.DBProvider.ExecuteScalar(varSql, new IDbDataParameter[] {
                    DBProvider.MakeParameter("workflowId", workFlowId),
                    DBProvider.MakeParameter("workFlowInstanceId", workFlowInstanceId)
                }));

                if (varType == "string")
                {
                    resultValue = "'" + resultValue + "'";
                }
                break;

            case WorkFlowConst.Access_WorkTask:
                varSql = string.Format("SELECT " + varFieldName + " FROM " + varTableName + " WHERE WORKFLOWID={0} AND WORKFLOWINSID={1} " +
                                       " AND WORKTASKINSID={2} ",
                                       DBProvider.GetParameter("workflowId"),
                                       DBProvider.GetParameter("workFlowInstanceId"),
                                       DBProvider.GetParameter("WorkTaskInsId"));
                if (paixu != "" && paixu != "请选择...")
                {
                    varSql = varSql + " ORDER BY " + paixu + " DESC";
                }
                resultValue = BusinessLogic.ConvertToString(
                    this.DBProvider.ExecuteScalar(varSql, new IDbDataParameter[] {
                    DBProvider.MakeParameter("workflowId", workFlowId),
                    DBProvider.MakeParameter("workFlowInstanceId", workFlowInstanceId),
                    DBProvider.MakeParameter("WorkTaskInsId", WorkTaskInstanceId)
                }));
                if (varType == "string")
                {
                    resultValue = "'" + resultValue + "'";
                }
                break;
            }

            if (string.IsNullOrEmpty(resultValue))
            {
                resultValue = varInitValue;
            }
            //if (varType == WorkFlowConst.SYSVarType_string) resultValue = "'" + resultValue + "'";//字符型要加单引号
            //if (string.IsNullOrEmpty(resultValue)) resultValue = "'" + resultValue + "'";//默认返回带引号的空字符串
            return(resultValue);
        }
示例#59
0
		/// <summary>
		/// Create a new MemberGroup
		/// </summary>
		/// <param Name="Name">The Name of the MemberGroup</param>
		/// <param Name="u">The creator of the MemberGroup</param>
		/// <returns>The new MemberGroup</returns>
		public static MemberGroup MakeNew(string Name, BusinessLogic.User u) 
		{
			Guid newId = Guid.NewGuid();
			CMSNode.MakeNew(-1,_objectType, u.Id, 1,  Name, newId);
			
			return new MemberGroup(newId);
		}
        /// <summary>
        /// 创建所有符合条件的任务实例
        /// </summary>
        /// <param name="userId">处理人Id</param>
        /// <param name="workFlowId">工作流模板id</param>
        /// <param name="workTaskId">当前任务Id</param>
        /// <param name="workFlowInstanceId">工作流实例Id</param>
        /// <param name="workTaskInstanceId">原任务实例Id</param>
        /// <param name="operatorInstanceId">处理者实例Id</param>
        /// <param name="commandName">命令</param>
        /// <returns>
        /// 000002:没有配置后续任务
        /// 000000:操作成功
        /// </returns>
        public string CreateNextTaskInstance(string userId, string workFlowId, string workTaskId, string workFlowInstanceId, string workTaskInstanceId, string operatorInstanceId, string commandName)
        {
            var userName = new PiUserManager(DbFactoryProvider.GetProvider(SystemInfo.RDIFrameworkDbType, SystemInfo.RDIFrameworkDbConectionString), this.UserInfo).GetEntity(userId).UserName;

            var dt = GetLineEndTasks(workFlowId, workTaskId, commandName);

            if (dt != null && dt.Rows.Count > 0)
            {
                var condition        = "";                  //条件
                var priority         = "";                  //优先级,只执行优先级最高的分支,如果优先级相同 那么同时执行。
                var endTaskId        = "";                  //后续任务节点Id
                var endoperRule      = "";                  //新任务处理者策略
                var startoperRule    = "";                  //当前任务处理者策略
                var taskType         = "";                  //节点类型
                var endTaskTypeAndOr = "";                  //控制节点专用,表示and/or
                var operParam        = new OperParameter(); //创建处理者参数

                #region 配置了后续节点
                var l = dt.Rows.Count;
                var branchPriority = dt.Rows[0]["PRIORITY"].ToString();//优先级
                //遍历满足条件的所有任务节点
                for (var i = 0; i < l; i++)
                {
                    var dr = dt.Rows[i];
                    condition            = dr["CONDITION"].ToString();
                    priority             = dr["PRIORITY"].ToString();
                    endTaskId            = dr["ENDTASKID"].ToString();
                    endoperRule          = dr["ENDOPERRULE"].ToString();
                    startoperRule        = dr["STARTOPERRULE"].ToString();
                    taskType             = dr["ENDTASKTYPEID"].ToString();
                    endTaskTypeAndOr     = dr["ENDTASKTYPEANDOR"].ToString();
                    operParam.OperRule   = endoperRule;
                    operParam.IsJumpSelf = Convert.ToBoolean(dr["ISJUMPSELF"]);
                    if (priority != branchPriority)
                    {
                        break;                                                                                          //只执行优先级最高的分支
                    }
                    if (ExpressPass(userId, workFlowId, workTaskId, workFlowInstanceId, workTaskInstanceId, condition)) //满足条件的任务节点
                    {
                        switch (taskType)
                        {
                        case "2":    //结束节点
                        {
                            #region 结束节点
                            //产生一个结束节点的实例
                            var newEndTaskId   = BusinessLogic.NewGuid();      //新任务处理者实例Id
                            var endWorktaskIns = new WorkTaskInstanceEntity
                            {
                                WorkFlowId     = workFlowId,
                                WorkTaskId     = endTaskId,
                                WorkFlowInsId  = workFlowInstanceId,
                                WorkTaskInsId  = newEndTaskId,
                                PreviousTaskId = workTaskInstanceId,
                                TaskInsCaption = new WorkTaskManager(this.DBProvider, this.UserInfo).GetTaskCaption(endTaskId),
                                Status         = "2"//结束节点不需要再处理,但此处不能为3,设置结束实例会修改该值=3
                            };
                            new WorkTaskInstanceManager(this.DBProvider, this.UserInfo).Create(endWorktaskIns);

                            //设置处理者实例正常结束
                            new OperatorInstanceManager(this.DBProvider, this.UserInfo).SetOperatorInstanceOver(userId, operatorInstanceId);
                            //设置任务实例正常结束
                            new WorkTaskInstanceManager(this.DBProvider, this.UserInfo).SetWorkTaskInstanceOver(userName, workTaskInstanceId);
                            new WorkTaskInstanceManager(this.DBProvider, this.UserInfo).SetWorkTaskInstanceOver(userName, newEndTaskId);        //结束节点实例 结束
                            //设置流程实例正常结束
                            new WorkFlowInstanceManager(this.DBProvider, this.UserInfo).SetWorkflowInstanceOver(workFlowInstanceId);
                            //设定流程实例的当前位置
                            new WorkFlowInstanceManager(this.DBProvider, this.UserInfo).SetCurrTaskId(workFlowInstanceId, endTaskId);
                            new WorkTaskInstanceManager(this.DBProvider, this.UserInfo).SetSuccessMsg(WorkFlowConst.WorkflowOverMsg, workTaskInstanceId);        //结束节点单独处理,任务提交给谁了
                            //检查是否子流程调用
                            DataTable operInfo = new WorkFlowInstanceManager(this.DBProvider, this.UserInfo).GetWorkflowInstance(workFlowInstanceId);
                            if (operInfo != null && operInfo.Rows.Count > 0)
                            {
                                var isSubWorkflow     = false;    //是否是子流程调用
                                var mainWorkflowInsId = "";
                                var mainWorktaskId    = "";
                                var mainWorkflowId    = "";
                                var mainWorktaskInsId = "";
                                isSubWorkflow     = BusinessLogic.ConvertIntToBoolean(operInfo.Rows[0][WorkFlowInstanceTable.FieldIsSubWorkflow]);
                                mainWorkflowInsId = operInfo.Rows[0][WorkFlowInstanceTable.FieldMainWorkflowInsId].ToString();  //主流程实例Id
                                mainWorktaskId    = operInfo.Rows[0][WorkFlowInstanceTable.FieldMainWorktaskId].ToString();     //子流程节点模板Id
                                mainWorkflowId    = operInfo.Rows[0][WorkFlowInstanceTable.FieldMainWorkflowId].ToString();     //主流程模板Id
                                mainWorktaskInsId = operInfo.Rows[0][WorkFlowInstanceTable.FieldMainWorktaskInsId].ToString();  //主任务实例Id,进入子节点前的任务节点实例
                                if (isSubWorkflow)
                                {
                                    //创建一个子流程节点实例痕迹,表示子流程节点处理完成
                                    var newTaskId        = BusinessLogic.NewGuid(); //新任务处理者实例Id
                                    var workTaskInstance = new WorkTaskInstanceEntity {
                                        WorkFlowId     = mainWorkflowId,
                                        WorkTaskId     = mainWorktaskId,
                                        WorkFlowInsId  = mainWorkflowInsId,
                                        WorkTaskInsId  = newTaskId,
                                        PreviousTaskId = mainWorktaskInsId,
                                        TaskInsCaption = "子流程",
                                        Status         = "3"
                                    };
                                    new WorkTaskInstanceManager(this.DBProvider, this.UserInfo).Create(workTaskInstance);
                                    var result = CreateNextTaskInstance(userId, mainWorkflowId, mainWorktaskId, mainWorkflowInsId, newTaskId, operatorInstanceId, "提交");
                                    if (result != WorkFlowConst.SuccessCode)
                                    {
                                        return(result);
                                    }
                                }
                            }
                            #endregion
                            break;
                        }

                        case "3":
                        {
                            #region 交互节点
                            switch (endoperRule)
                            {
                            case "1":
                            {
                                //创建一个任务实例
                                var newTaskId        = BusinessLogic.NewGuid();     //新任务处理者实例Id
                                var workTaskInstance = new WorkTaskInstanceEntity
                                {
                                    WorkFlowId     = workFlowId,
                                    WorkTaskId     = endTaskId,
                                    WorkFlowInsId  = workFlowInstanceId,
                                    WorkTaskInsId  = newTaskId,
                                    PreviousTaskId = workTaskInstanceId,
                                    TaskInsCaption = new WorkTaskManager(this.DBProvider, this.UserInfo).GetTaskCaption(endTaskId),
                                    Status         = "1"
                                };
                                new WorkTaskInstanceManager(this.DBProvider, this.UserInfo).Create(workTaskInstance);
                                //创建多个处理人
                                var result = CreateOperInstance(userId, workTaskInstanceId, workTaskId, workFlowId, endTaskId, workFlowInstanceId, newTaskId, operParam);            //创建处理者实例
                                if (result != WorkFlowConst.SuccessCode)
                                {
                                    return(result);
                                }
                            }
                            break;

                            case "2":
                            {
                                //创建任务实例和处理人
                                var result = CreateOperInstance(userId, workTaskInstanceId, workTaskId, workFlowId, endTaskId, workFlowInstanceId, workTaskInstanceId, operParam);
                                if (result != WorkFlowConst.SuccessCode)
                                {
                                    return(result);
                                }
                            }
                            break;
                            }

                            //设置处理者实例正常结束
                            new OperatorInstanceManager(this.DBProvider, this.UserInfo).SetOperatorInstanceOver(userId, operatorInstanceId);
                            //设置任务实例正常结束
                            new WorkTaskInstanceManager(this.DBProvider, this.UserInfo).SetWorkTaskInstanceOver(userName, workTaskInstanceId);
                            //设定流程实例的当前位置
                            new WorkFlowInstanceManager(this.DBProvider, this.UserInfo).SetCurrTaskId(workFlowInstanceId, endTaskId);
                            //设定任务实例成功提交信息
                            new WorkTaskInstanceManager(this.DBProvider, this.UserInfo).SetSuccessMsg(WorkFlowConst.SuccessMsg, workTaskInstanceId);
                            #endregion
                            break;
                        }

                        case "4":    //控制节点
                        {
                            #region 控制节点
                            //设置处理者实例正常结束
                            new OperatorInstanceManager(this.DBProvider, this.UserInfo).SetOperatorInstanceOver(userId, operatorInstanceId);
                            //设置任务实例正常结束
                            new WorkTaskInstanceManager(this.DBProvider, this.UserInfo).SetWorkTaskInstanceOver(userName, workTaskInstanceId);
                            //设定流程实例的当前位置
                            new WorkFlowInstanceManager(this.DBProvider, this.UserInfo).SetCurrTaskId(workFlowInstanceId, endTaskId);
                            //设定任务实例成功提交信息
                            new WorkTaskInstanceManager(this.DBProvider, this.UserInfo).SetSuccessMsg(WorkFlowConst.SuccessMsg, workTaskInstanceId);
                            //******start检查判断节点前面的所以节点的任务实例是否都完成


                            //取控制节点前端所以节点,进行逐个判断
                            var dtstart = GetLineStartTasks(workFlowId, endTaskId);
                            var allPass = true;        //全部通过
                            foreach (DataRow dr1 in dtstart.Rows)
                            {
                                var taskId = dr1["STARTTASKID"].ToString();
                                if (endTaskTypeAndOr == WorkConst.Command_Or)                                  //or分支
                                {
                                    if (IsPassJudge(workFlowId, workFlowInstanceId, taskId, endTaskTypeAndOr)) //判断每个节点实例是否完成
                                    {
                                        allPass = true;
                                        break;        //如果有一个通过即可。
                                    }
                                    allPass = false;
                                }
                                else                                                                            //and分支
                                {
                                    if (!IsPassJudge(workFlowId, workFlowInstanceId, taskId, endTaskTypeAndOr)) //判断每个节点实例是否完成
                                    {
                                        allPass = false;
                                        break;        //如果有一个未完成的,不产生新的实例,流程等待。
                                    }
                                }
                            }

                            //********end检查判断节点前面的所以节点的任务实例结束

                            //如果判断节点前面的流程实例全部完成,自动进行递归,创建下一任务实例。
                            if (allPass)
                            {
                                //创建一个判断节点实例
                                var newTaskId        = BusinessLogic.NewGuid(); //新任务处理者实例Id
                                var workTaskInstance = new WorkTaskInstanceEntity
                                {
                                    WorkFlowId     = workFlowId,
                                    WorkTaskId     = endTaskId,
                                    WorkFlowInsId  = workFlowInstanceId,
                                    WorkTaskInsId  = newTaskId,
                                    PreviousTaskId = workTaskInstanceId,
                                    TaskInsCaption = endTaskTypeAndOr,
                                    Status         = "3"
                                };
                                new WorkTaskInstanceManager(this.DBProvider, this.UserInfo).Create(workTaskInstance);
                                var result = CreateNextTaskInstance(userId, workFlowId, endTaskId, workFlowInstanceId, newTaskId, operatorInstanceId, "提交");
                                if (result != WorkFlowConst.SuccessCode)
                                {
                                    return(result);
                                }
                            }
                            #endregion
                            break;
                        }

                        case "5":    //查看节点
                        {
                            #region 查看节点
                            switch (endoperRule)
                            {
                            case "1":
                            {
                                //创建一个任务实例
                                var newTaskId        = BusinessLogic.NewGuid();     //新任务处理者实例Id
                                var workTaskInstance = new WorkTaskInstanceEntity
                                {
                                    WorkFlowId     = workFlowId,
                                    WorkTaskId     = endTaskId,
                                    WorkFlowInsId  = workFlowInstanceId,
                                    WorkTaskInsId  = newTaskId,
                                    PreviousTaskId = workTaskInstanceId,
                                    TaskInsCaption = new WorkTaskManager(this.DBProvider, this.UserInfo).GetTaskCaption(endTaskId),
                                    Status         = "1"
                                };
                                new WorkTaskInstanceManager(this.DBProvider, this.UserInfo).Create(workTaskInstance);

                                //创建多个处理人
                                var result = CreateOperInstance(userId, workTaskInstanceId, workTaskId, workFlowId, endTaskId, workFlowInstanceId, newTaskId, operParam);            //创建任务实例
                                if (result != WorkFlowConst.SuccessCode)
                                {
                                    return(result);
                                }
                            }
                            break;

                            case "2":
                            {
                                //创建任务实例和处理人

                                var result = CreateOperInstance(userId, workTaskInstanceId, workTaskId, workFlowId, endTaskId, workFlowInstanceId, workTaskInstanceId, operParam);
                                if (result != WorkFlowConst.SuccessCode)
                                {
                                    return(result);
                                }
                            }
                            break;
                            }
                            //设置处理者实例正常结束
                            new OperatorInstanceManager(this.DBProvider, this.UserInfo).SetOperatorInstanceOver(userId, operatorInstanceId);
                            //设置任务实例正常结束
                            new WorkTaskInstanceManager(this.DBProvider, this.UserInfo).SetWorkTaskInstanceOver(userName, workTaskInstanceId);
                            //设定流程实例的当前位置
                            new WorkFlowInstanceManager(this.DBProvider, this.UserInfo).SetCurrTaskId(workFlowInstanceId, endTaskId);
                            //设定任务实例成功提交信息
                            new WorkTaskInstanceManager(this.DBProvider, this.UserInfo).SetSuccessMsg(WorkFlowConst.SuccessMsg, workTaskInstanceId);
                            #endregion
                            break;
                        }

                        case "6":    //子流程节点
                        {
                            #region 子流程节点
                            var subWf = new SubWorkFlowManager(this.DBProvider, this.UserInfo).GetSubWorkflowTable(workFlowId, endTaskId);
                            if (subWf != null && subWf.Rows.Count > 0)
                            {
                                var subWorkflowId      = subWf.Rows[0][SubWorkFlowTable.FieldSubWorkFlowId].ToString();
                                var subStartTaskId     = subWf.Rows[0][SubWorkFlowTable.FieldSubStartTaskId].ToString();
                                var subWorkflowCaption = subWf.Rows[0][SubWorkFlowTable.FieldSubWorkFlowCaption].ToString();
                                //*******进入子流程
                                var wfruntime = new WorkFlowRuntime
                                {
                                    UserId             = userId,
                                    WorkFlowId         = subWorkflowId,
                                    WorkTaskId         = subStartTaskId,
                                    WorkFlowInstanceId = BusinessLogic.NewGuid(),
                                    WorkTaskInstanceId = BusinessLogic.NewGuid(),
                                    IsSubWorkflow      = true,
                                    MainWorkflowId     = workFlowId,
                                    MainWorkflowInsId  = workFlowInstanceId,
                                    MainWorktaskId     = endTaskId,
                                    MainWorktaskInsId  = workTaskInstanceId,       //记录进入子流程之前的任务实例
                                    WorkFlowNo         = "subWorkflow",
                                    CommandName        = "提交",
                                    WorkflowInsCaption = subWorkflowCaption,
                                    IsDraft            = true//开始节点需要交互,草稿状态,暂不提交
                                };
                                wfruntime.Start();
                                //设置处理者实例正常结束
                                new OperatorInstanceManager(this.DBProvider, this.UserInfo).SetOperatorInstanceOver(userId, operatorInstanceId);
                                //设置任务实例正常结束
                                new WorkTaskInstanceManager(this.DBProvider, this.UserInfo).SetWorkTaskInstanceOver(userName, workTaskInstanceId);
                                //设定流程实例的当前位置
                                new WorkFlowInstanceManager(this.DBProvider, this.UserInfo).SetCurrTaskId(workFlowInstanceId, endTaskId);
                                //设定任务实例成功提交信息
                                new WorkTaskInstanceManager(this.DBProvider, this.UserInfo).SetSuccessMsg(WorkFlowConst.SuccessMsg, workTaskInstanceId);
                            }
                            #endregion
                            break;
                        }
                        }
                    }
                }
                #endregion
            }
            else
            {   //未配置后续节点
                return(WorkFlowConst.NoFoundTaskCode);
            }
            return(WorkFlowConst.SuccessCode);
        }